...
and here is a maybe slightly neater approach using ?mapply (again with
the method column changed to character():
f <- function(meth,i,fr) do.call(meth,list((fr[i,])))
mapply(FUN=f,meth=input.df[,4],seq_len(nrow(input.df)),
MoreArgs = list(fr = input.df[,1:3]) )
Cheers,
Bert
Bert G
OOPS! I forgot to tell you that I first changed the "method" column,
which is a factor, to character, with
input.df$method <- as.character(input.df$method)
Then things will work properly.
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking t
1. return() is not needed in R functions (it's harmless, however). You
might wish to go through an R function tutorial (many good ones are on
the web) to learn about what slick things you can do with functions in
R.
2. The following is just a brute force loop, so more elegant
approaches are likely
3 matches
Mail list logo