Hi the list,

As it is say in its doc, the aggregate function remove empty subsets. Is it possible to NOT remove empty subset ?
--- 8< -------
m <- matrix(1:12,4)
part <- factor(c("A","B","A","B"),levels=c("A","B","C"))
aggregate(m,list(part),mean)

### I get:
#   Group.1 V1 V2 V3
# 1       A  2  6 10
# 2       B  3  7 11
#
### I would like:
#   Group.1 V1 V2 V3
# 1       A  2  6 10
# 2       B  3  7 11
# 3       C NA NA NA
--- 8< ------


Thanks
Christophe

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to