I keep getting this error and I\'m not quite sure what it means. All of my variable names are consistent and there are no typos. Am I missing something here?
The code >
Assuming it's not a typo (the data frame is called dataNew
in your call but datNew
in the error), are x
, y
, z
, a
and ab
the names of columns in dataNew
?
Some functions, like subset, will allow you to specify column names of the object they're working on directly. The aggregate function doesn't, so any columns of dataNew
listed in the by
argument need to specifically referred to as such. Try this:
datNewagg <- aggregate(dataNew,
by = list(
x = dataNew$x,
y = dataNew$y,
z = dataNew$z,
a = dataNew$a,
ab = dataNew$ab),
FUN = mean)