[R] use list elements to subtract values from the dataframe

Julian Burgos jmburgos at u.washington.edu
Wed May 7 19:37:44 CEST 2008


Try
get(paste("wf$",fl[[1]],sep=""))

See ?get

Julian


Dirkheld wrote:
> Hi,
> 
> I have a dataframe wf existing of a header with different labels and beneath
> the values of those labels :
> wf:
> label1  label2  ...
> 0,45    0,21
> 0,10    0,45 
> ....      ....
> 
> I have a list
> fl <- c("label2","label3",..)
> 
> Isn't possible to use the list elements in the list in order to subtract
> values from the dataframe? like :
> wf$fl[[1]] 
> When I do in R I get :NULL
> fl[[1]] gives  "label2"  so no problem here...
> 
> While wf$label1 works fine.
> 
> 
>



More information about the R-help mailing list