MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #15725] cannot edit empty dataframe in R.app #5273

Open MichaelChirico opened 4 years ago

MichaelChirico commented 4 years ago

meine.daten<-edit(as.data.frame(NULL)) 2014-03-26 08:56:39.842 R[492:707] run_REngineRmainloop: exception -[__NSArrayM insertObject:atIndex:]: index 1 beyond bounds for empty array caught during REPL iteration.


METADATA

MichaelChirico commented 4 years ago

From the error message, this is about the editor in R.app: that is not shared by any other platform, including command-line R on OS X.

It works for me in R.app, although I do not see why it is useful to edit an empty data frame. Did you interact with the editor windows in a way you have not described?


METADATA

MichaelChirico commented 4 years ago

I have experienced the same issue as Marc. I tried to edit an empty data frame and add a column. This created the error message that Marc saw. I pressed the stop button on the data editor window. This closed the data editor window. I could not further interact with R. If I tried to just list the value of previously defined variable (x and then enter), the program crashed and I had to force quit.

I am running R 3.1.2 GUI 1.65 Mavericks build (6833) on Mac OS X Yosemite 10.10.2.

As far usefulness, I think it is useful to create a data frame from scratch using a spreadsheet-like user interface. This method is also recommended some sources that I used to find out how to edit a data frame. This bug/issue/change-in-functionality invalidates those documentation sources.

Documentation source #1 Introductory Statistics with R (Second Edition) by Peter Dalgaard Per pg 52, I should be able to enter data into a blank data frame like so: dd <- data.frame() fix(dd)

fix(dd) is equivalent to dd <- edit(dd)

Documentation source #2 http://www.dummies.com/how-to/content/how-to-enter-data-into-the-r-text-editor.html This a web tip from the "For Dummies" brand of books.

Per this source, I should be able to enter data into a blank data frame like so:

elements <- data.frame() elements <- edit(elements)

(same method as #1)

---------- Other solutions: I know from StackOverflow that I can create a dimension blank data frame. http://stackoverflow.com/questions/9917545/r-define-dimensions-of-empty-data-frame

collect1 <- data.frame(id = character(0), max1 = numeric(0), max2 = numeric(0))

I can also create a data frame with a null. This was suggested both on the same stackoverflow thread and also at another website:

http://wiener.math.csi.cuny.edu/Statistics/R/simpleR/stat022.html data.entry(x=c(NA)) ---------- // end other solutions

So this is not a show stopper, but it is frustrating that these other documentation sources no longer provide the truth. And if you shouldn't be able to edit an empty data frame, it would be very nice of the data editor window to not allow you to try to add columns. Or R could refuse to open the data editor window. In either case, a helpful message about why the program is not cooperating would be good.

I'm not suggesting that this be done everywhere the user has an opportunity to crash the program. But this particular feature (editing empty data frames) is something that has been documented as not only possible but recommended practice before. So if it's going to cause a crash from now on, it'd be nice to have a warning and not crash. Or restore the ability to edit empty data frames.

My two cents.


METADATA