简体   繁体   中英

Can't Inspect Text Corpus in R

I am trying to create Corpus for further analysis, the code I am showing You suddenly stopped working and I cannot find solution for this error. I execute this:

library("tm")
library("SnowballC")
library("wordcloud")
library("arules")
library("arulesViz")
#library("e1071")

#WCZYTAJ_DANE######################################################################

setwd("D:/Dysk Google/Shared/SGGW/MGR_R2/Metody Eksploracji Danych/_PROJEKT")
smSPAM <- read.table("smSPAM.txt", sep="\t", quote="", stringsAsFactors = F)
dim(smSPAM)
colnames(smSPAM) <- c("class", 'text')
head(smSPAM,50)

#zamienia spam ham na 1 0
smSPAM$class=ifelse(smSPAM$class=="ham", "0", "1")
head(smSPAM$text,50)
#View(smSPAM[smSPAM$class=="1",])

#STWORZ_KORPUS#####################################################################

#tworze korpus na potrzeby documenttermmatrix
smSPAM.corp <- Corpus(VectorSource(smSPAM$text))
inspect(smSPAM.corp)

But I get this error in log:

Error in (function (classes, fdef, mtable):
unable to find an inherited method for function ‘inspect’ for signature ‘"VCorpus"’

However I can still perform stemming, removing white spaces etc. on this Corpus, only inspect doesn't work.

好的,我发现了我的问题所在-tm和arules软件包都包含检查功能,我必须分离arulesViz和arules(按顺序排列,因为前者需要后者),并且它再次正常工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM