R: Get the min/max of each item of a vector compared to single value

Viewed 3175

I want to compare a single value with each item of a vector (data.frame column) and receive a new vector as result.

a <- data.frame(v=c(3,1,5))
n <- 4
b <- # get max of `a$v` and `n` and return a vector
#desired output:
#[1] 4 4 5

The normal max function does not work.

1 Answers
Related