Re: [R] Question on Counting Factors - PS

2012-04-11 Thread S Ellison
> -Original Message- > This would do it in your example: > > > levels(animals$V1) <- c("cat","tiger","dog","fish") > > table(animals) > > cattigerdog fish > 2 200 But be very wary of levels(animals$V2)<- c("cat","tiger","dog","fish") table(animals

Re: [R] Question on Counting Factors

2012-04-11 Thread S Ellison
> I would like to get the frequency > (counts) of all the variables in a single column (that is > easy), but I would also like to return the value 0 for the > absence of variables defined in another column. If you use factor() on your columns and include all the animals in the factor levels, yo

Re: [R] Question on Counting Factors

2012-04-11 Thread David Barron
This would do it in your example: > levels(animals$V1) <- c("cat","tiger","dog","fish") > table(animals) cattigerdog fish 2 200 HTH David cat tiger dog fish 2 2 0 0 On 11 April 2012 14:21, Daniel Gabrieli wrote: > animals = as.data

Re: [R] Question on Counting Factors

2012-04-11 Thread David Winsemius
On Apr 11, 2012, at 9:21 AM, Daniel Gabrieli wrote: Hi, I hope this is not too trivial, but I've had this recurring problem and I think there is super easy solution, just not sure what it is. Please see short example below. I would like to get the frequency (counts) of all the variables in a

[R] Question on Counting Factors

2012-04-11 Thread Daniel Gabrieli
Hi, I hope this is not too trivial, but I've had this recurring problem and I think there is super easy solution, just not sure what it is. Please see short example below.  I would like to get the frequency (counts) of all the variables in a single column (that is easy), but I would also like to r