[Rd] Aggregate function FR

Morgan Morgan morg@n@em@||box @end|ng |rom gm@||@com
Wed Nov 20 15:26:02 CET 2019


I was wondering if it would be possible to add an argument to the aggreagte
function to retain NA by categories?(default can not to in order to avoid
breaking code) Please see below example:

df = iris
df$Species[5] = NA
aggregate(`Petal.Width` ~ Species, df, sum) # does not include NA
aggregate(`Petal.Width` ~ addNA(Species), df, sum) # include NA

data.table and dplyr include NA by default.
Python pandas has an aggreagate function inspired by base R aggregate. An
option has been added to include NA.

Thank you
Best regards

	[[alternative HTML version deleted]]

More information about the R-devel mailing list