I successfully created two wordclouds in Rmarkdown by importing two different datasets, but one wordcloud did not show up after I knit it to html. Does anyone know how to fix it?
output: html_document
knitr::opts_chunk$set(echo=FALSE, warning=FALSE, message=FALSE)
library(wordcloud2)
library(here)
library(rio)
WordCloud 1
s1 <- import(here("data", "set1.xlsx"))
wordcloud2(s1, color = "random-light", backgroundColor = "dark")
WordCloud 2
s2 <- import(here("data", "set2.xlsx"))
wordcloud2(s2, color = "random-light", backgroundColor = "dark")
Here's a fully reproducible working example that writes the results to image files then views them. I used
dput(head(s1))
to get the example data. Comment out for your environment.