Error while converting a vector of text strings to a corpus in R?



I am trying to convert a vector of text strings into a corpus element. I am using tm package in R to do so.

Following is my piece of code:


where s1$Yes is a factor with various levels, each level containing a text string

When I run this code, I an getting following error:

"Error: inherits(x, "Source") is not TRUE"

Any help to solve this error will be greatly appreciated.


I think you are trying to give Vector as input to Corpus. You can try something like Corpus(VectorSource(txt)) to give vector input to Corpus.
Hope this helps,


Thanks Tavish for your reply