我正在使用 tidytext。当我命令 unnest_tokens 时。R返回错误
请提供列名
我该如何解决这个错误?
library(tidytext)
library(tm)
library(dplyr)
library(stats)
library(base)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Build a corpus: a collection of statements
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
f <-Corpus(DirSource("C:/Users/Boon/Desktop/Dissertation/F"))
doc_dir <- "C:/Users/Boon/Desktop/Dis/F/f.csv"
doc <- read.csv(file_loc, header = TRUE)
docs<- Corpus(DataframeSource(doc))
dtm <- DocumentTermMatrix(docs)
text_df<-data_frame(line=1:115,docs=docs)
#This is the output from the code above,which is fine!:
# text_df
# A tibble: 115 x 2
#line docs
#<int> <S3: VCorpus>
# 1 1 <S3: VCorpus>
#2 2 <S3: VCorpus>
#3 3 <S3: VCorpus>
#4 4 <S3: VCorpus>
#5 5 <S3: VCorpus>
#6 6 <S3: VCorpus>
#7 7 <S3: VCorpus>
#8 8 <S3: VCorpus>
#9 9 <S3: VCorpus>
#10 10 <S3: VCorpus>
# ... with 105 more rows
unnest_tokens(word, docs)
# Error: Please supply column name