Pierre Mallard wrote:> Hi R-helpers.
> I have the following problem:
> I would like to apply my function gain(df,X,A) to a
> list of arguments.
> df is a data frame
> X,A are the varibales od data frame.
> When I do
>
>>gain(kyphosis,"Kyphosis",c("Start","Number"))
>
> [1] "Start" "Number"
> I get the following error...
> Error in unique.default(x) : unique() applies only to
> vectors
> I tried lapply and apply, it didn't seem to work...
>
> Can anybody tell me how to apply my function gain to a
> list of argument(in this case, my third argument
> changes)...
> Thanks in advance,
> pierre
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
lapply(c("Start", "Number"), function(x) gain(kyphosis,
"Kyphosis", x))
Uwe Ligges