Re: [R] NA vs. <NA>

From: hadley wickham <>
Date: Fri, 04 Apr 2008 11:09:53 -0500

On Fri, Apr 4, 2008 at 11:00 AM, Muenchen, Robert A (Bob) <> 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)



______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 04 Apr 2008 - 16:12:17 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 Fri 04 Apr 2008 - 17:30:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive