以下のループ機能をコンテンツの下に作成したいと思います。forループの作成方法
p1 <- read.table("positive1.txt")
(wordcount=table(p1))
palete=brewer.pal(9,"Set1")
wordcloud(names(wordcount), freq=wordcount, scale=c(5,1),
rot.per=.12,min.freq=1, random.order=F, random.color=T, colors=palete)
p2 <- read.table("positive2.txt")
(wordcount=table(p2))
palete=brewer.pal(9,"Set1")
wordcloud(names(wordcount), freq=wordcount, scale=c(5,1),
rot.per=.12,min.freq=1, random.order=F, random.color=T, colors=palete)
p3 <- read.table("positive3.txt")
(wordcount=table(p3))
palete=brewer.pal(9,"Set1")
wordcloud(names(wordcount), freq=wordcount, scale=c(5,1),
rot.per=.12,min.freq=1, random.order=F, random.color=T, colors=palete)
以下の文章を書くと、エラーメッセージが表示されます。
par(mfrow(1,3))
for (i in 1:3) {
p[i] <- readLines(con="positive[i].txt")
p0[i] <- scan("positive[i].txt", character(0), sep = "\n")
(wordcount[i]=table(p0[i]))
palete=brewer.pal(9,"Set1")
wordcloud(names(wordcount[i]), freq=wordcount, scale=c(5,1),
rot.per=.12,min.freq=1, random.order=F, random.color=T, colors=palete)
}
これらは私のエラーメッセージです:
Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'positive*.txt': Invalid argument