tm VectorSource produces VCorpus, but is shown as a list by RStudio

The following code ...

library(tm)

vectorOfText <- c("twas brillig and the slithey toves", 
                  "did gyre and gimble in the wabes")
names(vectorOfText) <- c("firstLine", "secondLine")

aCorpus <- VCorpus(VectorSource(vectorOfText))

produces aCorpus with a class of List of 2 - It should produce a VCorpus. At least, List of 2 is shown in the RStudio environment window.

However, class(aCorpus) executed in the console produces the correct class. For example

> class(aCorpus)
[1] "VCorpus" "Corpus"

Is this a known problem between tm and RStudio?

It's possible that this is a display issue specific to your installation of RStudio, or it could be related to the version of R, the tm package, or another package that you are using.
However, as long as the class() function correctly identifies the class of your object as VCorpus, you should be able to use it as intended in your R code without any issues.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.