Skip to contents

Returns the midpoints between the elements of a vector in the order the elements appear.

Usage

midpoints(x)

Arguments

x

A numeric vector with at least 2 elements.

Value

A numeric vector of length length(x) - 1.

Details

This function does not sort.

Examples

midpoints(c(0, 1, 10, 4))
#> [1] 0.5 5.5 7.0