search for: bugsal

Displaying 1 result from an estimated 1 matches for "bugsal".

Did you mean: begsal
2011 May 17
1
Zero counts in an aggregate function
...dd columns with counts of the number of 1s (alive) and 0s (dead) in each so that my data looks like this: FRUIT ALIVE DEAD 1 1 4 2 2 2 6 0 3 3 0 6 I have managed do do this using "aggregate" with FUN=sum for the 1 values... bugsALIVE<-aggregate(bugs$SURVIVE,by=list(bugs$FRUIT),FUN=sum,na.rm=TRUE) ...but am having trouble figuring out how to get counts of the 0 values since there is no built-in "count" function. I have tried to write my own function but I am fairly new to R and writing functions and have not fi...