最近的作业是用爬虫扒数据,自己探索做分析。
今天先把项目的文字云素材部分分享一下。
if (!require(devtools)) install.packages('devtools')
devtools::install_github("lchiffon/wordcloud2",force = TRUE)
报错:没有htmltools包
找了网上的教程,修改为:
ibrary(RCurl)
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
if (!require(devtools)) install.packages('devtools')
devtools::install_github("lchiffon/wordcloud2",force = TRUE)
载入成功。
library(wordcloud2)
wordcloud2(demoFreq,size = 1,shape='star')
wordcloud2(demoFreqC,size = 2, fontFamily = "微软雅黑",
color = "random-light",background = "grey")
报错:不存在“yaml”程序包
install.packages("yaml")
library(yaml)
完整代码
library(RCurl)
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
if (!require(devtools)) install.packages('devtools')
devtools::install_github("lchiffon/wordcloud2",force = TRUE)
install.packages("yaml")
library(yaml)
library(wordcloud2)
wordcloud2(demoFreq,size = 1,shape='star')
wordcloud2(demoFreqC,size = 2, fontFamily = "微软雅黑",
color = "random-light",background = "grey")
data <- read.csv('D:/数据/高考.csv',sep=",",header = T)
wordcloud2(data, size = 1, shape='round',color = 'random-light',
backgroundColor = "grey",fontFamily = "微软雅黑")
高考数据下载链接:http://pan.baidu.com/s/1jI4gEnc