[rkward-tracker] [ rkward-Feature Requests-2996981 ] Simple function to get labels from a dataframe.

SourceForge.net noreply at sourceforge.net
Sat May 8 17:00:12 UTC 2010


Feature Requests item #2996981, was opened at 2010-05-05 10:11
Message generated for change (Comment added) made by tfry
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=459010&aid=2996981&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: Plugins
Group: Next Release (example)
Status: Open
Priority: 5
Private: No
Submitted By: naught101 (naught101)
Assigned to: Nobody/Anonymous (nobody)
Summary: Simple function to get labels from a dataframe.

Initial Comment:
rkward stores dataframe variable labels as variable attribute metadata. It's possible to get a single label, with rk.get.label(dataframe[,x]), where x is the variable you want. It would be good to get all the labels from a dataframe, and store them as a vector. 

There might be a simpler way to do this, but this works for me:

rk.get.labels <- function(dataframe)
  {
  labelsvector <- c()
  for (i in 1:length(dataframe))
    {
    labelsvector <- c(labelsvector,rk.get.label(dataframe[,i]))
    }
  return(labelsvector)
  }

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

>Comment By: Thomas Friedrichsmeier (tfry)
Date: 2010-05-08 19:00

Message:
Thanks for the suggestion. I guess it's reasonable to add something like
that. However, we really need to start documenting those functions, before
we add too much. Let's see what we can do for the next release.

Here's a one-line version of your function:
rk.get.labels <- function (df) sapply (df, rk.get.label)

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

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




More information about the rkward-tracker mailing list