R text file and text mining…how to load data

后端 未结 6 1084
星月不相逢
星月不相逢 2020-12-13 10:51

I am using the R package tm and I want to do some text mining. This is one document and is treated as a bag of words.

I don\'t understand the documenta

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 11:25

    Here's my solution for a text file with a line per observation. the latest vignette on tm (Feb 2017) gives more detail.

    text <- read.delim(textFileName, header=F, sep = "\n",stringsAsFactors = F)
    colnames(text) <- c("MyCol")
    docs <- text$MyCol
    a <- VCorpus(VectorSource(docs))
    

提交回复
热议问题