Here is my solution:

tapply(zzz$DEATH1,zzz$GENDER,sum, na.rm=TRUE)



Dear R People:

Here is a little section of a data frame:

> zzz[1:10,]
           DATE GENDER AGE               Co DEATH1
3945  2009-04-16      M  24        Botulinic     23
3851  2009-04-16      M  35   Constitutional     23
8495  2009-04-16      F  49   Constitutional     27
10967 2009-04-16      F  47   Constitutional     28
11164 2009-04-16      F  26   Constitutional     28
15220 2009-04-16      M  49 Gastrointestinal     30
1207  2009-04-16      F  39            Other     20
1514  2009-04-16      F  39            Other     20
2548  2009-04-16      M  49            Other     22
3430  2009-04-16      F  54            Other     23
>

sometimes I want use the date and obtain the totals deaths, sometimes
I want to use the Co and obtain the total number of deaths, etc.


I've tried "table" and "with" but am having no success.

Any help would be much appreciated.

thanks,
Erin




--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

______________________________________________
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