If I have the following two equal sized vectors,
x <- c(1,2,3,4,5)
y <- c(5,4,3,2,1)
I would like to compare x and y at every corresponding index and return another vector of the same size containing the maximum (or minimum) at each index, so the third vector would return
5 4 3 4 5