I'm using R 3.3.1 in Windows 10 . I have a set of 3099 txt files that I am using for text mining with the tm()
package.
The code was working perfectly, but suddenly it started to fail ...
After trying to remove the accents from my corpus, the documents disappear.
I pursued the problem until the next line of code, which I used to remove the accents:
setwd("C:/txt")
library(tm)
cname <- file.path("C:", "txt")
docs <- Corpus(DirSource(cname))
docs <- tm_map(docs, tolower)
docs
<<VCorpus>>
Metadata: corpus specific: 0, document level (indexed): 0
Content: documents: **3099**
**docs <- chartr("áéíóú", "aeiou", docs)** # remove accents
docs <- Corpus(VectorSource(docs)) # back to a corpus
docs
<<VCorpus>>
Metadata: corpus specific: 0, document level (indexed): 0
Content: documents: **3**
As you can see, suddenly the 3099 documents are now only 3, and those 3 are blank.
No error was generated, nor alert. The strangest thing is that this code was working.
Can anyone guide me with this problem? When I do not give an error, I do not know how to solve it.