Search code examples
rr-markdownwordcloud2

RMarkdown only showing first out of multiple plots


[EDIT] updated for much simpler, reproducible output that generates same issue.

Code below. When I knit the code, only the first wordcloud shows up. I can put either function (month, year) in the first section and the plot will show. Why are my other plots not generating?

---
title: "Untitled"
output: html_document
---

```{r setup, include=FALSE}
library(RColorBrewer)
library(wordcloud2)
create.wordcloud <- function(text){
  return(wordcloud2(data=text, size = 0.8,
                    color='random-dark',
                    shape = "circle"))
}
test.1 <- table(LETTERS)
test.2 <- table(letters)
```

## Word Cloud for Calendar Year 2021:

```{r year, echo=FALSE}
create.wordcloud(test.1)
```

## Word Cloud by Month {.tabset .tabset-pills}
### January
```{r jan, echo=FALSE}
create.wordcloud(test.2)
```

##{}

Solution

  • Seems to be an issue with the package version on the CRAN. Get latest from:

    remotes::install_github("lchiffon/wordcloud2")
    

    Once I ran this snippet above and then your example again, I was able to produce the wordcloud plots