Re: [R] Factor function

From: Ista Zahn <izahn_at_psych.rochester.edu>
Date: Mon, 25 Apr 2011 16:22:44 -0400

Hi Lisa,

NA != "NA"

The first represents a missing observation, the second represents a character string.

HTH,
Ista

On Mon, Apr 25, 2011 at 3:53 PM, Lisa <lisajca_at_gmail.com> wrote:
> Dear All,
>
> I just want to remove “NA” from the levels of a factor.  For example:
>
> d<-data.frame(matrix(c("ww","ww","xx","yy","ww","yy","xx","yy","NA"),
> ncol=3, byrow=TRUE))
>
>> factor(d[, 3], exclude=NA)
> [1] xx yy NA
> Levels: NA xx yy
>
> But “NA” is still listed in the levels. How can I solve this problem? Thanks
> in advance.
>
> Lisa
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Factor-function-tp3473984p3473984.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>

-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

______________________________________________
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 Mon 25 Apr 2011 - 20:25:37 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 Mon 25 Apr 2011 - 21:00:33 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