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

text_mining
r

#1

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:

Corpus(s1$Yes)

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.


#2

RoveR,
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,
Tavish


#3

Thanks Tavish for your reply