1. 뉴스 크롤링

url="https://sports.news.naver.com/wfootball/news/read.nhn?oid=109&aid=0003834601" # URL
library(rvest)
page <- read_html(url,encoding = "UTF-8") # 인코딩 확인하기 
article <- page%>%html_nodes("#newsEndContents")%>%html_text()
article

2. 명사 추출

library(KoNLP)
text=lapply(article,extractNoun)
text=unlist(text)

3. 한글 추출

x <- gsub("[^A-Za-z가-힣[:space:][:digit:][:punct:]]", "", text)
x <- gsub("@|\n|RT", "", x)
x <- gsub("[[:punct:]]", " ", x)
x <- gsub("[[:digit:]]", "", x)
x <- tolower(x)
x <- gsub("[a-z]", "", x)
x <- str_trim(x)
x

4. 워드클라우드

library(KoNLP)
x1 <- lapply(x, extractNoun)
x2 <- lapply(x1, function(x) x[nchar(x)>1])
x3 <- do.call(c, x2)
o <- table(x3)

library(wordcloud)
pal <- brewer.pal(8,"Dark2")
wordcloud(names(o), o, min.freq=3, random.order=F,random.color=T,colors=pal,family="AppleGothic")