[rkward-users] [rkward - Help] RE: manipulating data.frame labels via script

SourceForge.net noreply at sourceforge.net
Sun Oct 7 07:57:11 UTC 2007


Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=4556197
By: fsando

Hi Kapatp
Thanks for your quick reply.

The point of labels in general is to indicate the real meaning of a variable
which can not be contained in the name.
In particular in rkward there is a field in the editor that shows labels.
You can see this if you open a data.frame in the editor (right click the object
and chose 'edit'). Write a label in the label field of one of the variabels,
then try this in the console:
attributes(data[["varname"]])

If you import an spss dataset with read.spss from the foreign package you get
the labels as an attribute:
attr(data,"variable.labels")
Which means that there is an attribute vector for the whole dataset for each
extra attribute.

It appears that rkward has created their own attribute which is like this: 
attr(data[["varname"]],".rk.meta")
That is, rkward adds an 'attribute-tree' to each individual variable

I have been digging a little deeper.
First: My initial code is wrong, it should probably be:
attr(data,".rk.meta")["label"] <- "This is a label"

Second: I reinstalled 0.4.8 and tested again, and I believe there may be a bug
in 0.4.8 regarding labels.
When I add labels the 'official' way writing it in the label field it disappears
when I reload the data.
Another thing is that 0.4.8 is _much_ slower than 0.4.2 (from 15 to 20 times
slower ie. from 2 sek to over 30 sek for one operation)
This could of course all be because 0.4.8 is not suitable for ubuntu 7.04

So my question still is: is the code above correct in relation to 0.4.8 (even
if it does not work on my machine at the moment) or should I change it to make
sure it will work in the future?


______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit: 
https://sourceforge.net/forum/unmonitor.php?forum_id=165574




More information about the Rkward-users mailing list