[rkward-tracker] [ rkward-Bugs-3142569 ] FIXED IN SVN: data corruption after changing var to factor

SourceForge.net noreply at sourceforge.net
Thu Dec 23 12:44:06 UTC 2010

Bugs item #3142569, was opened at 2010-12-23 10:27
Message generated for change (Comment added) made by ziogelis77
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: data handling
Group: None
Status: Open
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Donatas G. (ziogelis77)
Assigned to: Thomas Friedrichsmeier (tfry)
Summary: FIXED IN SVN: data corruption after changing var to factor

Initial Comment:
In data frame editor I sometimes need to change data type from numeric to factor and then add levels. If I do it in this order, everything is ok. But if I add levels first, and only then do I change the variable type to factor, the data in the variable column gets lost. This happens every time you do it. Before you close the editor, you still see the variable in the editor window, but if you print the data frame column in console, all you see is NA's. The data disappears right after the second action - changing the data type. If you leave the data type „number“, is.numeric(df$b) still reports TRUE, although the number is displayed. A workaround is: after doing it the wrong way you need to copy the column content to a csv file, and then copy it from there and paste it back. 

Tested in both linux (ubuntu) and windows version of rkward 0.5.4
KDE windows: KDE 4.4.1 (rkward bundle)
KDE on linux – current stable 4.5.4
> R.version
platform       i386-pc-mingw32              
arch           i386                         
os             mingw32                      
system         i386, mingw32                
major          2                            
minor          11.1                         
year           2010                         
month          05                           
day            31                           
svn rev        52157                        
language       R                            
version.string R version 2.11.1 (2010-05-31)

To reproduce:


Then open and edit the data set changing data type and then adding levels, column a – in the correct order, column b – in the incorrect order.

close df

run df:
> df
       a    b c
1  first <NA> 4
2 second <NA> 2
3  third <NA> 2
4 fourth <NA> 1


>Comment By: Donatas G. (ziogelis77)
Date: 2010-12-23 14:44

Man you are quick! Thank you though, even when you know the right order,
mixing things up happens too often.



Comment By: Thomas Friedrichsmeier (tfry)
Date: 2010-12-23 13:48


Embarrassing. Thanks for reporting this issue.

The problem should now be fixed in the development version
(http://p.sf.net/rkward/svn). For Ubuntu, a fixed version should be
available from our daily build archive tomorrow



You can respond by visiting: 

More information about the rkward-tracker mailing list