Skip to content

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

3 messages · Peter Dalgaard, Rolf Turner

#
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?

	cheers,

		Rolf Turner

P.S.
R version 2.12.0 (2010-10-15)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_NZ.UTF-8/en_NZ.UTF-8/C/C/en_NZ.UTF-8/en_NZ.UTF-8

attached base packages:
[1] datasets  utils     stats     graphics  grDevices methods   base     

other attached packages:
[1] misc_0.0-13     gtools_2.6.2    spatstat_1.20-5 deldir_0.0-12  
[5] mgcv_1.6-2      fortunes_1.4-0  MASS_7.3-8     

loaded via a namespace (and not attached):
[1] grid_2.12.0        lattice_0.19-13    Matrix_0.999375-44 nlme_3.1-97       
[5] tools_2.12.0
#
On 11/02/2010 09:45 PM, Rolf Turner wrote:
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.
#
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.
[1] "Europe"     "Africa"     "NA"         NA           "SA"        
[6] "Antarctica"
[1] 1

	cheers,

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