Compute a vector of midpoints between values in a numeric vector

mid(x)

Arguments

x

a numeric vector

Value

a vector of length 1 less than x

Examples

mid(1:5)
#> [1] 1.5 2.5 3.5 4.5
mid((1:5)^2)
#> [1]  2.5  6.5 12.5 20.5