Skip to content

뉴스 생산량 (trend) 표 그리기

Chan-Yub Park edited this page Jun 12, 2017 · 2 revisions
if (!require("devtools")) install.packages("devtools")
devtools::install_github("forkonlp/N2H4")
library(N2H4)
if (!require("ggplot2")) install.packages("ggplot2")
library(ggplot2)

strDate<-"2017-01-01"
endDate<-"2017-04-29"

qs<-c("문재인","홍준표","안철수","유승민","심상정")

dat<-c()
for(q in qs){
  print(q)
  tem <- getNewsTrend(q,strDate,endDate)
  dat<-rbind(dat,cbind(data.frame(q=q,tem)))
}

ggplot(dat,aes(x=date,y=cnt,group=q,color=q)) + geom_line()