convert a vector of characters to a vector of numeric coordinates

vector_to_coord(x, scale = NA, range = c(0, 1))

Arguments

x

a vector of characters, which will be coerced into factor.

scale

a vector of length(x) - 1 numeric values to control adjacent spacing. Set NA or NULL for equally dividing.

range

a vector of 2 numeric values defining a interval, where x will be mapped.

Value

a vector of length(x)

Examples

vector_to_coord(1:4, scale = c(2,2,2), range(1, 9))
#> [1] 1.000000 3.666667 6.333333 9.000000