Description Usage Arguments Details Value
View source: R/dismisc-extrapolate.R
Uses a spline or lm to extrapolate (and interpolate) values.
1 | dismisc_extrapolate(x, y, xout = x, method = "natural")
|
x |
the independent variable; something like a time value |
y |
the dependent variable; something like a population value |
xout |
values to interpolate/extrapolate on, defaults to x |
method |
can be "lm" or any method in stats::spline() |
Use in a dplyr chain something like this to extrapolate (and interpolate) within city (for example):
df %<>% group_by(city) %>% mutate_at(total_population,
funs(population_interpolated = dismisc_extrapolate(x=year,y=.)))
If there are no non-missing y values, a vector of NAs is returned.
the values of the extrapolated function y(x) on domain xout
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.