[R] factor question

From: Edna Bell <edna.bell01_at_gmail.com>
Date: Thu, 24 Jul 2008 14:19:53 -0500


Suppose I have a factor:

> fac1 <- factor(rep(c("dog","cat","tree"),c(2,3,4)))
> fac1

[1] dog dog cat cat cat tree tree tree tree Levels: cat dog tree
> length(fac1)

[1] 9

Now I want to get rid of the dogs:
> fac1 <- fac1[3:9]
> fac1

[1] cat cat cat tree tree tree tree
Levels: cat dog tree

How should I remove the dog from the level, please?

Thanks in advance,
Edna Bell

R-help_at_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. Received on Thu 24 Jul 2008 - 19:24:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jul 2008 - 20:34:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive