You can achieve that using Reduce
with the option accumulate=T
:
Reduce(min,mins,accumulate=T)
[1] 10 5 5 5 5 5 5 5 2 2
Or more simply, as @Henrik mentioned in a comment, using the cummin
function which returns the cumulative minimum:
cummin(mins)
[1] 10 5 5 5 5 5 5 5 2 2