Dear all,
when I build a dataframe using ds.dataFrame with e.g.
ds.dataFrame(x= c("D$age","D$sex","D$bmi"), newobj = "T")
I do not know how to extract the variables in the dataframe T. The variables are called “D$age” and so on, but e.g.
ds.mean("T$D$bmi")
does not work.
Best wishes,
Daniela
Daniela,
This is an issue I have had to deal with a number of times.
My personal workaround is to use ‘ds.assign’. So I would do (or something like):
ds.assign("D$age", "age")
ds.assign("D$sex", "sex")
ds.assign("D$bmi", "bmi")
ds.dataFrame(x= c(“age”,“sex”,“bmi”), newobj = “T”)
Then the following should work (I think):
ds.mean("T$bmi")
Stuart
Thanks Stuart!
Unfortunately, this is not an option here for me, as I am working with high-dimensional data and instead of
c("age","sex","bmi")
I actually have a vector with a high number of variables. It would be very great if a dataframe is part of the name of an input variable, this would just be removed or if new names could be provided for a given dataframe or as an input for the ds.dataFrame funciton.
Hi,
In the past I ran into trouble using T as a name for a variable because it is shorthand for TRUE in R. The same goes for F for FALSE.
Perhaps if you try a different name it might work better?
Tom
Hi,
this is of course true, but I just wrote T here to shorten what I had to write, I used another name…
Best
Daniela
Hi Daniela,
We have updated the ds.dataFrame function and now removes directly any “D$” parts from the column names of the assigned data frames. The new version will be included in v6.0 of DataSHIELD.