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)