[rkward-devel] Potential Data editor bug

Prasenjit Kapat kapatp at gmail.com
Sun Sep 19 05:14:59 UTC 2010


Hi,

On Thu, Sep 16, 2010 at 2:44 PM, Thomas Friedrichsmeier
<thomas.friedrichsmeier at ruhr-uni-bochum.de> wrote:
> Hi,
>
> On Thursday 16 September 2010, Stefan Rödiger wrote:
>> BTW, as you might consent the lines attached in my example are not a good
>> example how to work with R (size and arrangement of data ...). Thus it was
>> really interesting for me to see what happens ... .
>
> I think the crucial thing in your example is that there are some duplicate
> names in the data.frame:

Right. Sorry for the wrong flag earlier.

> There are three objects called "D09". I don't think we can reasonably support
> this in the editor (probably the editor should just drop two of these
> variables), but of course it should not crash.

Here is something that I found interesting. Consider the last two
lines of Stefan's Procedure.txt:

data <- data.frame (....
names (data) <- c(...

The crash is deterministic after you run these two lines individually
(ie, "Run current line").

But the crash does NOT occur after you run them together (ie, "Run
selection") or after you run the whole file (ie "Run all") or after
_source ("Procedure.txt")_. Stefan can you confirm this?

Although, in many attempts I could not reproduce the crash using any
of the following toy examples:

Eg 1:
data <- as.data.frame (matrix (rnorm (3636), 101, 36))
names (data) <- rep ("A", 36)

Here 101 and 36 were chosen based on Stefan's variable lengths.

Eg 2:
data <- as.data.frame (matrix (1:70,10,7))
names (data) <- c("A","B","C","A","D","E","A")

Eg 3:
data <- data.frame (A=1:10, B=11:20, C=21:30, A=31:40, D=41:50,
E=51:60, A=61:70)
names (data) <- c("A","B","C","A","D","E","A")

Eg 4:
A=1:10; B=11:20; C=21:30; D=41:50; E=51:60
data <- data.frame (A,B,C,A,D,E,A)
names (data) <- c("A","B","C","A","D","E","A")

When editing these, note that the order of the D and E columns as
displayed in the data editor are swapped; which happens with Stefan's
example as well (E07/F07 and C07/G07). I was just trying to create
another reproducible (toy) example.

As a caution to the user: Should a warning be displayed when the data
editor encounters multiple columns with same name? Noting that, the
data itself is not lost, it is just not displayed and hence not safe
to be edited! (Or is it safe anyways?)

Regards,
-- 
Prasenjit




More information about the Rkward-devel mailing list