I have a set of 9 csv files and I use the commands below to import them and do some data preprocessing:
library(tm)
filenames <- list.files(getwd(),pattern=”*.txt”)
files <- lapply(filenames,readLines)
docs <- Corpus(VectorSource(files))
Then i removed stop words.
Now, I have a corpus with 9 elements. I need to save them in 9 separate CSV files.
Does anyone know how to do it?
You can use writeCorpus(docs)
to write your corpus to 9 separate .txt
files. You can consequently convert these to .csv
if you like.