[R] keep empty subsets using aggregate

2009-11-24 Thread Fang (Betty) Yang
Dear all,

 

I am struggling with a small problem. By using aggregate, the empty subsets
are removed. I need each empty subset to be 0. Any suggestions will be
appreciated. 

 

Code:

 

edref = aggregate(rep(1,times=dim(eds)[1]),list(eds[,11], eds[,7],
eds[,27]), sum)

 

 

Thanks in advance,

 

Betty

 

 

 


[[alternative HTML version deleted]]

__
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.


Re: [R] keep empty subsets using aggregate

2009-11-24 Thread David Winsemius


On Nov 24, 2009, at 5:03 PM, Fang (Betty) Yang wrote:


Dear all,



I am struggling with a small problem. By using aggregate, the empty  
subsets

are removed. I need each empty subset to be 0. Any suggestions will be
appreciated.

Code:

edref = aggregate(rep(1,times=dim(eds)[1]),list(eds[,11], eds[,7],
eds[,27]), sum)



That's the code, but where is the sample data?:

E.g.:
dput(eds)

Or:

dput( head(eds, 30) )

Or:

dump(eds, stdout() )


--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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.