I used this error.
A simple solution to remove this error is to write all the variables along with their data set name, for example, "ds_name $ var_name".
I'm not sure if the name of your dataset is your business, so I will give you another example.
curYearRev <-aggregate(hr$Year.Total, by = list(hr$Hospital_ID,hr$District_ID,hr$Instrument_ID) , FUN = sum)
Here, “hr” is the name of the data set and “Year.Total”, “Hospital_ID”, “District_ID”, “Instrument_ID” are the variables in the data set “hr”.
Writing aggregate functions in this way will never again give you any errors.
source share