This is a post with executable code.
Show code
word_matrix[-(4:8),]|>gt()|>
tab_header(
title = md("Word_Matrix"),
subtitle = md("levels = c(0,1), labels = c('NO','YES')")
)|>
data_color(
columns = everything(),
fn = scales::col_factor(
palette = c("white",'lightgreen'),
domain = NULL)
)|>
tab_options(
table.background.color = 'white',
heading.background.color = "tomato",
table_body.vlines.style = "dotted",
)
levels = c(0,1), labels = c(‘NO’,‘YES’) |
YES |
YES |
YES |
YES |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
YES |
YES |
YES |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
YES |
YES |
YES |
YES |
YES |
YES |
YES |
YES |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
NO |
YES |
NO |
NO |
Show code
freq <- sort(colSums(as.matrix(dtm)), decreasing = TRUE)
wf <- data.frame(word=names(freq), freq = freq)
set.seed(1234)
wordcloud(words = wf$word, freq = wf$freq, min.freq = 1, max.words = 200,
random.order = FALSE, rot.per = 0.35, colors = brewer.pal(8, 'Dark2'))
Show code
- 1
-
start with
wordfreq
data frame
- 2
-
then slice the top 6 rows
- 3
-
and make a table with
gt()
Frequency |
call |
556 |
now |
428 |
get |
427 |
can |
383 |
will |
355 |
just |
340 |
You can add options to executable code like this