Re: [R] Applying ifelse() on different functions

2011-07-30 Thread Duncan Murdoch
On 11-07-30 3:56 PM, Megh Dal wrote: Dear all, I am looking for some procedure to apply 'ifelse' condition on function. I have created an alternative to lapply() function with exactly same set of arguments named lapply1(), however with different internal codes. Therefore I want something like,

Re: [R] Applying ifelse() on different functions

2011-07-30 Thread Joshua Wiley
You can use ifelse() if you want... x <- 1:10 ifelse(x < 5, mean(x), length(x)) Although I do not really see how you are hoping to improve on if (condition) lapply1() else lapply(). Josh On Sat, Jul 30, 2011 at 12:56 PM, Megh Dal wrote: > Dear all, I am looking for some procedure to apply 'ife

[R] Applying ifelse() on different functions

2011-07-30 Thread Megh Dal
Dear all, I am looking for some procedure to apply 'ifelse' condition on function. I have created an alternative to lapply() function with exactly same set of arguments named lapply1(), however with different internal codes. Therefore I want something like, if (some condition) then call lapply1(