Thanks a lot. Its really helpful Regards Saba
On Saturday, 23 April 2016, 6:50, Giorgio Garziano <giorgio.garzi...@ericsson.com> wrote: Since the aggregate S3 method for class formula already has got na.action = na.omit, ## S3 method for class 'formula' aggregate(formula, data, FUN, ..., subset, na.action = na.omit) I think that to deal with NA's, it is enough: aggregate(Value~ID, dta, max) Moreover, passing na.rm = FALSE/TRUE is "don't care": aggregate(Value~ID, dta, max, na.rm=FALSE) result is: ID Value 1 1 0.69 2 2 0.99 3 3 1.00 4 4 1.00 5 5 0.50 which is the same of na.rm=TRUE. On the contrary, in the following cases: aggregate(Value~ID, dta, max, na.action = na.pass) ID Value 1 1 0.69 2 2 0.99 3 3 1.00 4 4 NA 5 5 0.50 aggregate(Value~ID, dta, max, na.action = na.fail) Error in na.fail.default(list(Value = c(0.69, 0.31, 0.01, 0.99, 1, NA the result is different. -- Best, GG [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.