-5

I have a vector containing the minimum and maximum of 3 ranges i.e

low<-1,2,3
high<-2,3,4

represent the ranges 1-2,2-3,and 3-4

I need to return a third vector containing the midpoint of each range i.e.

mid<-1.5,2.5,3.5

Any quick way to do this?

4

1 回答 1

5

假设你实际上有low <- c(1, 2, 3)等,那么:

mid <- (low + high)/2
于 2012-08-25T09:12:44.713 回答