I can create a corpus in R but when I try to apply tm_map functions to it I get the following error message:
Error in UseMethod("as.PlainTextDocument", x) : no applicable method for 'as.PlainTextDocument' applied to an object of class "c('PlainTextDocument', 'TextDocument', 'character')"
The code up to that point is:
setwd("C:/…/Documents/TextMining")
webtextGoogle <- GoogleNewsSource("Greek shipping")
GreekShippingContent <- WebCorpus(GoogleNewsSource("Greek shipping"))
writeCorpus(GreekShippingContent, "C:/…/Documents/TextMining", filenames = paste(seq_along(GreekShippingContent), ".txt", sep=""))
GreekShippingContent0 <- Corpus(DirSource("C:/…/Documents/TextMining"), list(reader = readPlain))
GreekShippingContent2 <- tm_map(GreekShippingContent0, as.PlainTextDocument)
I have looked in the documentation and explanations of what this means in related contexts but I cannot understand what to do (not a developer). Can anyone correct the code? I have learned a lot by example. Thanks.
lapply(GreekShippingContent0, as.PlainTextDocument)but it's just a guess. - Tyler Rinkerdputto help make it. So here's an example where I provide a MWE: stackoverflow.com/questions/19804615/… No worries on the as expected. Every new social situation you have to learn the norms. That's why I said something otherwise you just keep posting and don't get help because you unknowingly violated the norms. - Tyler Rinker