In the source code of the tm text-mining R-package, in file transform.R, there is the removePunctuation()
function, currently defined as:
functi
I had the same problem, custom function was not working, but actually the first line below has to be added
Regards
Susana
replaceExpressions <- function(x) UseMethod("replaceExpressions", x)
replaceExpressions.PlainTextDocument <- replaceExpressions.character <- function(x) {
x <- gsub(".", " ", x, ignore.case =FALSE, fixed = TRUE)
x <- gsub(",", " ", x, ignore.case =FALSE, fixed = TRUE)
x <- gsub(":", " ", x, ignore.case =FALSE, fixed = TRUE)
return(x)
}
notes_pre_clean <- tm_map(notes, replaceExpressions, useMeta = FALSE)