Create your wordcloud

code
analysis
Author

Me

Published

January 30, 2024

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",
    
    )
Word_Matrix
levels = c(0,1), labels = c(‘NO’,‘YES’)
great point wat world joke lar wif appli comp cup entri final free may receiv
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
library(gt)
1wordfreq
2
1
start with wordfreqdata frame
2
then slice the top 6 rows
3
and make a table withgt()
Wordcloud
Frequency
word freq
call 556
now 428
get 427
can 383
will 355
just 340

You can add options to executable code like this

Show code
Frequency_Barplot