Hello, In the following code, any characters matching "/|@| \\|") will be changed to a space. > library(tm) > toSpace <- content_transformer(function(x, pattern) gsub(pattern, " ", x)) > docs <- tm_map(docs, toSpace, "/|@| \\|")
What code would transform all non-letters to a space? (What goes where the xxxxx's are.)It is very difficult to put all non-letters in a string... So I'm doing the opposite of the above. > toSpace_2 <- content_transformer(function xxxxxxxxxxxxxxxxxxxxxxx)) > docs <- tm_map(docs, toSpace_2, "abcdefghijklmnopqrstuvwxyz") This needs to be done by a content_transformer() function to maintain the integrity of docs. Thanks [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.