'no non-missing arguments to max
I am trying to create a word cloud with the image text below
wordcloud(words = wcdata_table$Dispensed_State, freq = wcdata_table$Date,scale=c( ,0.25),
max.words=10, colors=brewer.pal(5, "Accent"))
and I keep getting the error:
> Error in -freq : invalid argument to unary operator
In addition: Warning message:
In max(freq) : no non-missing arguments to max; returning -Inf
picture of script
I have all the other script but for some reason, I keep getting this error message. Any help would be appreciated. Thank you.
#INSTALLING PACKAGES
install.packages("data.table") #fread
install.packages("dplyr") #ranking frequency
install.packages("grDevices") #png function
install.packages("wordcloud") #wordcloud
install.packages("RColorBrewer") #brewer colors
#libraries
library(data.table)
library(dplyr)
library(grDevices)
library(wordcloud)
library(RColorBrewer)
#read in data table
#already have data on computer called myData and don't want to
overwrite
wcdata = fread("7-2_assessment.csv")
#convert to data table
wcdata = as.data.table(wcdata)
#table of despensed state column
#filter by value
wcdata_tab = wcdata[DispensedState!=""]
wcdata_tab2 = wcdata_tab[,.N, by=Date]
#50 states
wcdata_table = wcdata_tab2[order(-N)] %>% head(50) %>%
rename("DispensedState" =N, "States"= "DispensedState")
#wordcloud
png("Dispensed State.png", width =14,height=10, units= 'in',
res=400)
par(mar = rep(0, 4))
set.seed(1337)
wordcloud(words = wcdata_table$DispensedState, freq =
wcdata_table$Date,scale=c( ,0.25),
max.words=10, colors=brewer.pal(5, "Accent"))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

