colored categories in r wordclouds
Using the wordcloud package in R I would like to color different words according to a categorical variable in the dataset. Say my data is as follows: name weight group 1 Aba 10 x 2 Bcd 20 y 3 Cde 30 z 4 Def 5 x And here as a dput : dat <- structure(list(name = c("Aba", "Bcd", "Cde", "Def"), weight = c(10, 20, 30, 5), group= c("x", "y", "z", "x")), .Names = c("name", "weight", "group"), row.names = c(NA, -4L), class = "data.frame") Is there a way in wordcloud() to color the names by their group (x, y, z) or should I use different software/packages? It will automatically choose from a color list