Files
uni-ba-socialagenda/functions.R
T

9 lines
370 B
R
Raw Normal View History

2014-11-29 13:52:09 +01:00
require(stringr)
2014-11-29 21:41:28 +01:00
# Replace characters messing up JSON validation (\,\n,^)
correctJSON <- function(string) {
string <- str_replace_all(string, pattern = perl('\\\\(?![tn"])'), replacement = " ")
string <- str_replace_all(string, pattern = fixed("\n"), replacement = " ")
string <- str_replace_all(string, pattern = fixed("^"), replacement = " ")
return(string)
}