Lchiffon / wordcloud2

R interface to wordcloud for data visualization.
397 stars 113 forks source link

Fix warning if data in wordcloud2 has more than one class #27

Closed ekstroem closed 7 years ago

ekstroem commented 7 years ago

If you provide an object with more than one class then the first if condition in wordcloud2 produces a warning. This is especially true with tidyr tibbles that are both tibbles and data .frames

wordcounts %>% mutate(freq=n) %>% wordcloud2(minSize=6) Warning message: In if (class(data) == "table") { : the condition has length > 1 and only the first element will be used

The pull request changes the condition such that it looks for a table somewhere in the vector of classes.

ekstroem commented 7 years ago

Oh ... and added a better (and more correct) explanation for minSize