Reputation: 399
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.
Upvotes: 0
Views: 1991
Reputation: 399
Ok I found what my problem was - both tm and arules packages containt inspect functions do I had to detach arulesViz and arules (in that order cause latter is needed by former) and It's working again.
Upvotes: 2