[R] evaluate expression on several dataframe columns

R user R-user at zutt.org
Mon Dec 20 11:47:40 CET 2004


Hi R-users,

I have a collection of dataframes and know how to build
a string that refers to it, in this example, name_infra_alg_inc.
Then, I have a character string yval, which the user can select
from a drop down list. It contains the column names of the
dataframes.

assign(paste(name_infra_alg_inc, "ci", sep="."),
  ci(get(name_infra_alg_inc)[[yval]], confidence=0.95))

My problem is that I sometimes want to combine columns.
For example, if there are columns A, B and C.
Would it be possible that yval has the value "A+B*C" and
then call some sort of evaluate function?
Maybe I could attach the dataframe and then call some function,
I don't know how to figure this out, so hopefully someone can help me.

Thanks in advance




More information about the R-help mailing list