Error message: dfm() and corpus_reshape() 'only works on corpus objects'

I get repeated error messages that a corpus object is not a corpus object.
I cannot understand what is wrong.
In R studio I created a small corpus of 2 text files. This is a sample of their content (yes, the files have empty lines):
' Strategy

and

measures for its implementation
'
'''
library(tm)
library(topicmodels)
library(quanteda)
corpus1 <- Corpus(DirSource(directory="C:/Users/etc."))
'''
I checked corpus1 and it looks fine

corpus1 <> Metadata: corpus specific: 1, document level (indexed): 0 Content: documents: 2
However, I get an error message, when I try these commands.

'''
corp = corpus_reshape(corpus1, to="paragraphs")
Error: corpus_reshape() only works on corpus objects
'''
'''
dfm=dfm(corpus1,remove_punct=T, remove=stopwords("english"))
Error: dfm() only works on character, corpus, dfm, tokens objects.
'''

This topic was automatically closed 42 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.