RStudio中换行:Shift+enter
读取xls的函数:> library(readxl)
> data <- read_excel("/Users/huangxinran/Desktop/output/Desktop/test.xls",1)
获取dataframe里的某几列构成新的dataframe:sentimentData=data[,c(6,7)]
更改列名: names(sdata)<-c("location","sentiment","count")
数据的汇总统计:sdata=sqldf("select location,sentiment,count(1) from data group by location,sentiment")
散点图:ggplot(data, aes( x=data$X,y = data$确诊.新增.) +geom_point()
折线图:ggplot(data, aes( x=X,y=xinzeng)) +geom_line()+ geom_point(size=1, shape=1)+geom_text(aes(y = xinzeng + .2, label =date), size=3)