[R] ...listable functions...
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
> > list of arguments.
> > df is a data frame
> > X,A are the varibales od data frame.
> > When I do
> >  "Start" "Number"
> > I get the following error...
> > Error in unique.default(x) : unique() applies only
> > vectors
> > I tried lapply and apply, it didn't seem to
> > 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
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
> lapply(c("Start", "Number"), function(x)
> gain(kyphosis, "Kyphosis", x))
> Uwe Ligges
More information about the R-help