[R] ...listable functions...
Pierre Mallard
pierremallard at yahoo.fr
Sat May 24 20:22:11 CEST 2003
--- Uwe Ligges <ligges at statistik.uni-dortmund.de> a
écrit : > 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
Thanks a lot...it works now,
although I had to change it to
lapply(list("Start", "Number"), function(x)
gain(kyphosis, "Kyphosis", x))
because he was understanding as if it were the
isolated values...
best regards,
pierre
>
> lapply(c("Start", "Number"), function(x)
> gain(kyphosis, "Kyphosis", x))
>
> Uwe Ligges
>
More information about the R-help
mailing list