Dear Tanushree,
I hope you are doing good.
Can you try to run the below code with tm-0.5 version.
Please remove the existing package of tm.
remove.packages("tm")
Install the tm-0.5 package with the below command.
Command: install.packages("http://cran.r-project.org/bin/windows/contrib/3.0/tm_0.5-10.zip",repos=NULL)
Later run the below R script and check.
DB<-read.csv("NFL_SocialMedia_sample_data1.csv",head=T)
head(DB)
social_text<-data.frame(DB[,1])
colnames(social_text)<-c("Contents")
corpus1<-Corpus(VectorSource(social_text$Contents))
corpus2<- tm_map(corpus1, tolower)
corpus3<- tm_map(corpus2, removeWords, stopwords("english"))
corpus4<- tm_map(corpus3, removePunctuation)
corpus5<- tm_map(corpus4, removeNumbers)
corpus6<- tm_map(corpus5, stripWhitespace)
dtm <- DocumentTermMatrix(corpus6)
dtm_tfxidf <- weightTfIdf(dtm)
m <- as.matrix(dtm_tfxidf)
rownames(m) <- 1:nrow(m)
norm_eucl <- function(m) m/apply(m, MARGIN=1, FUN=function(x) sum(x^2)^.5)
m_norm <- norm_eucl(m)
cl <- kmeans(dtm_tfxidf, 10)
cl
I have tried it on my end and it is working fine. Please refer to the below screenshot.