[R] factor question

Edna Bell edna.bell01 at gmail.com
Thu Jul 24 21:19:53 CEST 2008


Hi!

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



More information about the R-help mailing list