evenly: Create a sequence of evenly-spaced values

evenlyR Documentation

Create a sequence of evenly-spaced values

Description

For a continuous vector x, evenly and seq_min_max() create a sequence of n evenly-spaced values over the range min(x)max(x). For a factor x, the function returns levels(x).

Usage

evenly(x, n = 100, by = NULL)

seq_min_max(x, n, by = NULL)

Arguments

x

numeric; vector over which evenly-spaced values are returned

n

numeric; the number of evenly-spaced values to return. A default of 100 is used for convenience as that what is typically used when evaluating a smooth.

by

numeric; the increment of the sequence. If specified, argument n is ignored and the sequence returned will be from min(x) to max(x) in increments of by.

Value

A numeric vector of length n.

Examples


x <- rnorm(10)
n <- 10L
evenly(x, n = n)

gratia documentation built on Feb. 16, 2023, 10:40 p.m.