[R] NA vs. <NA>

From: Muenchen, Robert A (Bob) <muenchen_at_utk.edu>
Date: Fri, 04 Apr 2008 12:00:13 -0400


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.

Thanks,
Bob

> gender <- c("f","f","f",NA,"m","m","m","m")
> gender

[1] "f" "f" "f" NA "m" "m" "m" "m" #here it lacks brackets.
>
> q1 <- c(1,2,2,3,4,5,5,4)
> q1
[1] 1 2 2 3 4 5 5 4
>
> myDF <- data.frame(q1,gender)
> myDF

  q1 gender

1  1      f
2  2      f
3  2      f
4  3   <NA>  #here it has brackets.
5  4      m
6  5      m
7  5      m
8  4      m

=========================================================
Bob Muenchen (pronounced Min'-chen),
Manager, Statistical Consulting Center
U of TN Office of Information Technology Stokely Management Center, Suite 200
916 Volunteer Blvd., Knoxville, TN 37996-0520 Voice: (865) 974-5230
FAX: (865) 974-4810
Email: muenchen_at_utk.edu
Web: http://oit.utk.edu/scc
Map: http://www.utk.edu/maps 

news: http://listserv.utk.edu/archives/statnews.html


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 Fri 04 Apr 2008 - 16:02:45 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive