I have a list of text files in my directory, all of which are documents with multiple paragraphs. I want to read those documents and do sentiment analysis.
For example, I have one text document data/hello.txt
with text like below:
"Hello world.
This is an apple.
That is an orange"
I read the document in like below (there can also be multiple documents):
docs <- VCorpus(DirSource('./data/hello.txt'))
When I look at the document content docs[[1]]$content
It seems like it is character vector.
[1] "hello world" "this is apple." ""
[4] "That is an orange. " ""
My question is how I can read in those documents so that in each document, paragraphs are concatenated into one single character string so that I can use it for sentiment analysis. (VCorpus from tm package)
Thanks a lot.