8
$\begingroup$

I am attempting to use the tm package to convert a vector of text strings to a corpus element.

My code looks something like this

Corpus(d1$Yes)

where d1$Yes is a factor with 124 levels, each containing a text string.

For example, d1$Yes[246] = "So we can get the boat out!"

I'm receiving the following error:

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

I'm not sure how to remedy this.

$\endgroup$

1 Answer 1

9
$\begingroup$

You have to tell Corpus what kind of source you are using. Try:

Corpus(VectorSource(d1$Yes))
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.