[R] simple payoff function

Santosh Srinivas santosh.srinivas at gmail.com
Sat Dec 11 16:09:55 CET 2010


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)



More information about the R-help mailing list