¾È³çÇϽʴϱî? ¼®»ç°úÁ¤ 3±â ÀÌÁß¿øÀÔ´Ï´Ù.
³×À̹ö ´º½º ´ñ±Û ¼öÁý ÆÐÅ°Áö N2H4¸¦ È°¿ëÇÑ R ¼Ò½º ÄÚµåÀÔ´Ï´Ù.
MIT(Massachusetts Institute of Technology) ¶óÀ̼¾½º ÀÔ´Ï´Ù.
¼¹ö¿¡ °úÇÑ ºÎÇϸ¦ °¡ÇÏ´Â ºü¸¥ ¼öÁýÀº ºñ¸Å³Ê¿¡ ÇØ´çÇÕ´Ï´Ù.
È®½ÇÈ÷ ÇÊ¿äÇÑ ¸¸Å¸¸ ÀûÁ¤ÇÑ ¼Óµµ·Î ¼öÁýÇÏ½Ã±æ ±ÇÀåµå¸³´Ï´Ù.
setwd("")
if (!require("devtools")) install.packages("devtools")
devtools::install_github("forkonlp/N2H4")
install.packages("iterators")
library(N2H4)
# N2H4 ÆÐÅ°Áö ±¸µ¿½Ã ¿ä±¸µÇ´Â ½ÇÇàȯ°æ
sessionInfo()
# ÇöÀç ½Ã°¢°ú character º¯¼öÈ
t <- Sys.time()
cat(t,"\n")
t <- strftime(t,"%Y-%m-%d %H:%M:%S")
# ÁöÁ¤µÈ url·ÎºÎÅÍ ´ñ±Û µ¥ÀÌÅÍ ¼öÁý. lst[,-46] ºÎºÐÀº NA °ªÀÌ µé¾î¿À´Â Çʵ忩¼ ÀÓÀÇ·Î Á¦°Å.
comm <- getComment(turl = url)
comments <- comm$result$count$comment
comm <- getComment(turl = url , pageSize = comments, page = 1)
lst <- comm$result$commentList
lst <- as.data.frame(lst)
lst <- lst[,-46]
head(lst$contents)
# ¹Ýº¹¹® ¿¹Á¦
starttime <- vector()
# url ¸®½ºÆ®¸¦ csv³ª ÅؽºÆ® ÆÄÀÏ ÇüÅ·Π°¡Á®¿Ã °æ¿ì
url <- readLines("urllink.csv")
for(i in 1:10){
t <- Sys.time()
cat(t,"\n")
t <- strftime(t,"%Y-%m-%d %H:%M:%S")
starttime[i] <- t
comm <- getComment(turl = url[i])
comments <- comm$result$count$comment
comm <- getComment(turl = url[i] , pageSize = comments, page = 1)
lst <- comm$result$commentList
lst <- as.data.frame(lst)
lst <- lst[,-46]
write.csv(lst, paste("commentscollect",i,".csv",sep=""))
}
filename <- vector()
for(i in 1:10){
filename[i] <- paste("commentscollect",i,".csv",sep="")
}
timelist <- cbind(filename,starttime)
write.csv(timelist, "timelist.csv")
# ´ñ±Û µ¥ÀÌÅÍ ÆÄÀÏÀº commentscollect ¹øÈ£ . csv·Î ÀúÀå, ¼öÁý ½ÃÀÛ ½Ã°£Àº timelist.csv¿¡ ÀúÀå.