library(ggplot2)
df_words<- data.frame(word = c("unto","said","thou","thy","thee","shall","god","lord","will","land","came","father","jacob","sons","son","upon","joseph","earth","abraham","behold" ),
freq = c(598, 478,284,279,268,259,230,206,195,187,176,169,166,158,148,141,138,121,121,118))
head(df_words)
## word freq
## 1 unto 598
## 2 said 478
## 3 thou 284
## 4 thy 279
## 5 thee 268
## 6 shall 259
library(dplyr)
##
## 다음의 패키지를 부착합니다: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
order <- arrange(df_words, freq)$word
ggplot(data = df_words, aes( x = word ,y = freq)) +
ylim(0, 600) +
geom_col() +
coord_flip() +
scale_x_discrete(limit = order) +
geom_text(aes(label = freq), hjust = -0.1)

library(wordcloud)
## Warning: 패키지 'wordcloud'는 R 버전 4.3.2에서 작성되었습니다
## 필요한 패키지를 로딩중입니다: RColorBrewer
library(RColorBrewer)
pal <- brewer.pal(8,"Dark2") # 색상 목록 생성
set.seed(1234) # 난수 고정
wordcloud(words = df_words$word, # 단어
freq = df_words$freq, # 빈도
min.freq = 10, # 최소 단어 빈도
max.words = 200, # 표현 단어 수
random.order = F, # 고빈도 단어 중앙 배치
rot.per = .1, # 회전 단어 비율
scale = c(6, 0.2), # 단어 크기 범위
colors = pal) # 색상 목록
