Message-ID: <43304846.7070700@statistik.uni-dortmund.de>
Date: 2005-09-20T17:35:02Z
From: Uwe Ligges
Subject: How to exclude a level from a factor
In-Reply-To: <Pine.A41.4.63.0509201248590.214750@acsrs3.bu.edu>
Qiong Yang wrote:
> Hi,
>
> I could not use 'exlcude=' option in factor()
> to exclude a level from a existing factor.
>
> x is a factor:
>
>
>>x
>
> [1] a b c
> Levels: a b c
>
>
>>factor(x,exclude="c")
>
> [1] a b c
> Levels: a b c
> Warning message:
> NAs introduced by coercion
>
> However, "c" is not coded as NA.
>
> The following does not work either:
>
>
>>factor(x,exclude=factor("c",levels=c("a","b","c")))
>
> [1] a b c
> Levels: a b c
>
>
> What's wrong with my codes?
factor(x, levels=letters[1:2])
Uwe Ligges
> Thanks for any help
>
> Qiong Yang
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html