I whant to resume a lot of similar commands into a for loop.
q001<-Corpus(VectorSource(read.table("./q001.txt",encoding="latin1")))
q001<-Corpus(VectorSource(read.table("./q001.txt",encoding="latin1")))
....
q150<-Corpus(VectorSource(read.table("./q150.txt",encoding="latin1")))
I have limited computational resources that´s why I want to build separate corpus, clean and make tdm on each of them and later merge all the final tdm into a single tdm matrix
I build the following loop
for(i in bNames){
filepath <- paste("./Sample/", i,".txt", sep="")
assign(i, Corpus(VectorSource(read.table(filepath,encoding="latin1")))
}
Where bNames is a list of files to be read as individual corpus
And gets an error:
Error: unexpected '}' in:
" assign(i, Corpus(VectorSource(read.table(filepath,encoding="latin1")))
}"
What I'm doing wrong?
您在assign
末尾缺少括号
assign(i, Corpus(VectorSource(read.table(filepath,encoding="latin1"))))
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.