Wordclouds from csv/xlxs file with frequencies

Hello everyone,

I am trying to create a wordcloud from a csv file (I also have the xlxs format). The file is a list of words and the frequency value for each of them, so I only need to visualise the dataset as a wordcloud or network. Does anyone know how I can do that? I know how to do this from a plain text, but in this case I already know the frequency values.

Thank you!

Hi,

If your data is setup already, you can use the package wordcloud2. In general, I recommend the book by Julia Silge and David Robinson

Hope this helps.

JW

1 Like

Here's an example with days in office before assassination. . Assume Days_in_office is the same as frequency:

library(wordcloud)
library(dplyr)

df <- data.frame(President = c("Lincoln", "Garfield", "McKinley", "Kennedy"),
Days_in_office = c(1503,199,1654,1036) )

image

df %>% with(wordcloud(words=President, freq=Days_in_office, random.order=FALSE, random.color=FALSE, rot.per = 0, colors = c("blue", "black", "red")))

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.