I'm working on a project in R that involves a lot of wordclouds (using wordcloud2) being generated, most of them in their own chunks. Within the R markdown itself, everything works and appears fine. However, when I knit the markdown into an html file, only the first three wordclouds show up. After doing a little testing, it appears this is not an issue with any of the particular wordclouds--if I add include=F
to any of the first three wordcloud chunks, thereby removing it from the knitted html, the fourth wordcloud will show up, so that there are still 3 in the knitted html. The knitted html will still have white space sized for any wordcloud it doesn't display (after the first three), but nothing will occupy it. If I increase the figure dimensions for that chunk, the white space size will increase but still no wordcloud. I'd love to figure this out so that the html shows everything I've told it to.
Thanks!
Edit: reproducible code:
trial <- structure(list(word = c("ran", "came", "down", "again", "far",
"flowed", "looked", "said", "saw", "suddenly", "ago", "already",
"back", "busy", "capable", "cast", "clear", "constant", "cool",
"dark", "did", "dived", "divided", "downhill", "driven", "endless",
"falling", "filled", "floating", "flowing", "formless", "found",
"gently", "going", "grey", "had", "heard", "here", "Here", "horrible",
"however", "issued", "Just", "laid", "lay", "leaping", "led",
"lived", "loomed", "made", "many", "much", "murmuring", "narrow",
"noisily", "old", "out", "proudly", "reached", "running", "sad",
"same", "sank", "shining", "silver", "skilfully", "slipped",
"slow", "sluggish", "smooth", "south", "spilled", "spreading",
"strong", "swiftly", "thought", "together", "tortuous", "used",
"wandered", "were", "white", "wished", "woke", "wormed"), n = c(6L,
5L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L)), row.names = c(NA, -85L), class = c("tbl_df",
"tbl", "data.frame"))
require(wordcloud2)
wordcloud2(trial)
wordcloud2(trial)
wordcloud2(trial) #these three should each be in their own chunks