Re: [R] simple payoff function

2010-12-11 Thread Romain Francois
Le 11/12/10 16:09, Santosh Srinivas a écrit : Just wondering if there is a better way to do this? x<- seq(4,20,1) y<- sapply(x, function(x) (max(x-10,0))) Is there a easier way to get to y? i.e. max(x-10,0) Hello, You are probably looking for pmax, that is described in the same help page

[R] simple payoff function

2010-12-11 Thread Santosh Srinivas
Just wondering if there is a better way to do this? x <- seq(4,20,1) y <- sapply(x, function(x) (max(x-10,0))) Is there a easier way to get to y? i.e. max(x-10,0) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS