Rolf Turner
2010-Nov-02 20:45 UTC
[R] Display of NAs in character columns of a data frame under fix() or edit().
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.> sessionInfo()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
Peter Dalgaard
2010-Nov-02 22:45 UTC
[R] Display of NAs in character columns of a data frame under fix() or edit().
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