I have a huge data frame, last 30 rows are below:
libary(data.table)
dput(p)
structure(list(DATE = structure(c(1367516015,
The problem is that your ifelse
statement returns integer
type for some values and numeric
(double) for some other entries. And data.table
complains about the mismatch in the column type as it expects the coercion to be performed by the user (for performance reasons as given in the error). So, just wrap it around with as.numeric
so that all values will be converted to double.
p <- p[,RELATIVE_PERCENT := as.numeric(ifelse(ENT_PCT>100, (USED_CORES/ENT)*100,
USR_SYS_CPU_PCT)), by= c("DATE", "LPAR")]