On Fri, Apr 4, 2008 at 11:00 AM, Muenchen, Robert A (Bob)
<[EMAIL PROTECTED]> wrote:
> Dear R-Helpers,
>
>  Why does R show character missing values in vectors as NA and when
>  stored in a data frame as <NA>? I've searched but did not find an
>  explanation.

It's because that character vector is automatically coerced into a factor:

> factor(gender)
[1] f    f    f    <NA> m    m    m    m
Levels: f m

I'd imagine the display is different so you can tell the difference
between NA and level "NA".
(This isn't a problem for strings because they have quotes around them)

Hadley


-- 
http://had.co.nz/

______________________________________________
R-help@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.

Reply via email to