[R] Display of NAs in character columns of a data frame under fix() or edit().

Rolf Turner r.turner at auckland.ac.nz
Wed Nov 3 00:03:00 CET 2010

Thanks Peter.  Makes sense.  But I would like to point out
that it *is* possible to distinguish between ``NA'' meaning
North America and ``NA'' meaning ``missing value'' in *ordinary*
printing of character vectors.  E.g.

> x <- c("Europe","Africa","NA",NA,"SA","Antarctica")
> x
[1] "Europe"     "Africa"     "NA"         NA           "SA"        
[6] "Antarctica"
> sum(is.na(x))
[1] 1



On 3/11/2010, at 11:45 AM, Peter Dalgaard wrote:

> On 11/02/2010 09:45 PM, Rolf Turner wrote:
>> Example:
>> 	xxx <- data.frame(x=1:26,y=letters)
>> 	xxx$x[c(2,4,6,8)] <- NA
>> 	xxx$y[c(1,3,5,7)] <- NA
>> 	yyy <- edit(yyy)
>> The missing values in xxx$y appear as blanks in the spreadsheet window that
>> appears, whereas the missing values in the numeric column "x" appear as "NA"
>> (as I would expect).
>> Is this a bug or a feature?
> Probably feature, How would you enter abbreviations for North America,
> Noradrenaline, Neil Adams, etc...? On the other hand, it is currently
> impossible to make a field blank.
> Actually, the whole edit() interface is a bit of a long-standing bug.
> It's been with us "forever" (as far as I remember, the spreadsheet
> interface actually predates data frames in R). It was constructed using
> very basic GUI elements on Windows and X11, and it never _quite_ did
> what you'd want it to do.
> Ideas about how to do better seem to have gotten stuck in indecision
> about which graphical toolkit to use. The Rcmdr has a data viewer (but
> not editor) written with the Tcl/Tk interface, which might be a starting
> point.
> -- 
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Phone: (+45)38153501
> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com

More information about the R-help mailing list