Error using TM VCorpus package in R

I encountered an error below when working with a TM package with R.

library("tm")
Loading required package: NLP
Warning messages:
1: packagetmwas built under R version 3.4.2 
2: packageNLPwas built under R version 3.4.1 

corpus <- VCorpus(DataframeSource(data))

Error: all (! Is.na (match (c ("doc_id", "text"), names (x)))) is not TRUE

We tried various methods, such as reinstalling the package, updating with the new version of R, but the error still persists. For the same data file, the same code runs on a different system with the same version of R.

+8
source share
1 answer

I met the same problem when I upgraded the package tmto version 0.7-2. I was looking for details DataframeSource(), he mentioned:

"doc_id" . "".

x . "doc_id" . "" "UTF-8", . .

:

df_cmp<- read.csv("test_file.csv",stringsAsFactors = F)

df_title <- data.frame(doc_id=row.names(df_cmp),
                       text=df_cmp$English.title)

doc_id text.

+15

Source: https://habr.com/ru/post/1689604/


All Articles