1
When trying to add values per person, I get the error below saying that the function sum
does not work for factors, however, my vector is numerical and even using a function to ensure this, I continue to receive the error!
url <- "https://raw.githack.com/fsbmat/StackOverflow/master/DiariasT.csv"
Diaria2 <- data.table::fread(url, dec = ",",colClasses = c("factor", "factor", "numeric","numeric", "numeric"))
Diaria2$VALOR_DIA <- as.numeric(as.character(Diaria2$VALOR_DIA))
agg = aggregate(Diaria2,
by = list(Diaria2$VALOR_DIA),
FUN = sum)
Error in Summary.factor(18L, na.rm = FALSE) :
‘sum’ not meaningful for factors
Wants to aggregate by
NOME_ORG_SOL
, forNOME
or both?– Rui Barradas
I want to add by NAME.
– fsbmat