| lerp | R Documentation |
Linear interpolation
lerp(object, ...)
## Default S3 method:
lerp(
object,
x = NULL,
xout = NULL,
nm = FALSE,
extrapolate = FALSE,
...,
verbose = getOption("verbose")
)
## S3 method for class 'lerp'
predict(
object,
envir = NULL,
method = "linear",
extrapolate = FALSE,
...,
verbose = getOption("verbose")
)
object |
(see Details) must contain values to be interpolated |
... |
further arguments passed to |
x |
(vector) x-coords; if not supplied, values to be interpolated are assumed to be evenly spaced |
xout |
(numeric) points at which to make predictions |
verbose |
(logical) display messages |
Names may be assigned to the resulting vector. If nm is FALSE, then no names will be assigned.
default: replace NAs with interpolated values
lerp: calculate values using a formula
year <- c(1991, 1993, 1995, 1998) sales <- c(21, NA, 40, 45) sales_model <- lerp(sales ~ year, data = data.frame(year, sales)) lerp(sales) lerp(sales, year) predict(sales_model, tibble::tibble(year = 1990:2000)) predict(sales_model, tibble::tibble(year = 1990:2000), extrapolate = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.