knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

oneliners

The goal of oneliners is to create easy functions to use for basic interpolation.

Installation

You can install the development version of oneliners from GitHub with:

# install.packages("devtools")
devtools::install_github("datr-studio/oneliners")

Example

The basic usage returns a function that can generate n points on a line given by two cartesian points.

library(oneliners)

point1 <- c(1, 1)
point2 <- c(10, 10)

f <- get_f_from_points(point1, point2)

This function can now be called with any number of points.

plot(f(-1:20))

Alternatively, exponential interpolation is also possible.

f2 <- get_f_exp_from_points(point1, point2)
plot(f2(1:10))

The default power is 3, but this can be specified directly as an argument.

f3 <- get_f_exp_from_points(point1, point2, power = pi)
plot(f3(1:20))


firthj/oneliners documentation built on June 29, 2022, 11:19 p.m.