pb210_as_fit: Coerce objects to exponential fits

View source: R/models.R

pb210_as_fitR Documentation

Coerce objects to exponential fits

Description

This is used to sanitize input for pb210_cic() and pb210_crs(), where fit objects are required but where it is anticipated that numeric constants will be common as input.

Usage

pb210_as_fit(x, ...)

## Default S3 method:
pb210_as_fit(x, ...)

## S3 method for class 'numeric'
pb210_as_fit(x, ...)

pb210_fit_lazy(x)

## S3 method for class ''function''
pb210_as_fit(x, ...)

## S3 method for class 'formula'
pb210_as_fit(x, ...)

## S3 method for class 'pb210_fit_lazy'
pb210_as_fit(x, data = NULL, ...)

Arguments

x

An object

...

Unused.

data

For lazy fits, this object is a tibble with cumulative_dry_mass and excess.

Value

An object with a stats::predict() method.

Examples

fake_depth <- 0:10
fake_pb210 <- exp(5 - fake_depth) + rnorm(11, sd = 0.005)

pb210_as_fit(pb210_fit_exponential(fake_depth, fake_pb210))
pb210_as_fit(1)
pb210_as_fit(0)


paleolimbot/pb210 documentation built on May 8, 2022, 8:10 a.m.