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

SourceForge.net noreply at sourceforge.net
Thu Dec 23 11:48:40 UTC 2010


Bugs item #3142569, was opened at 2010-12-23 09:27
Message generated for change (Comment added) made by tfry
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=459007&aid=3142569&group_id=50231

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                
status                                      
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:

a=c(1,2,3,4)
b=c(1,1,2,4)
c=c(4,2,2,1)
df=data.frame(a,b,c)

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: Thomas Friedrichsmeier (tfry)
Date: 2010-12-23 12:48

Message:
Hi!

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
(https://launchpad.net/~rkward-devel/+archive/rkward-dailys).

Regards
Thomas

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=459007&aid=3142569&group_id=50231




More information about the rkward-tracker mailing list