> -----Original Message-----
> This would do it in your example:
>
> > levels(animals$V1) <- c("cat","tiger","dog","fish")
> > table(animals)
>
> cat tiger dog fish
> 2 2 0 0
But be very wary of
levels(animals$V2)<- c("cat","tiger","dog","fish")
table(animals$V2)
cat tiger dog fish
2 2 0 0 # !!
levels overwrites factor levels... factor(x, levels = ...) doesn't.
S*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
______________________________________________
[email protected] 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.