drop_and_pivot: Drop unneeded columns from data, and pivot longer

View source: R/add_model_preds.R

drop_and_pivotR Documentation

Drop unneeded columns from data, and pivot longer

Description

A helper function to add_predictions

Usage

drop_and_pivot(
  by_var,
  drop_raw = TRUE,
  temperature_col = c("Temperature_norm"),
  keep_data_cols = c("resid", "pred"),
  ...
)

Arguments

by_var

A nested tibble, as output by add_nls()

drop_raw

A boolean, specifying whether or not to drop unnecessary columns from data. Defaults to TRUE, which minimizes output size, but requires re-joining with layouts after fitting for exploratory data analysis and plotting.

temperature_col

a character vector containing, as a string, the name of the column containing normalized Temperature. Defaults to c("Temperature_norm"). Could also include non-normalized Temperature (e.g. c("Temperature_norm", "Temperature")), but this is currently not particularly well supported by the downstream functions.

keep_data_cols

a character vector containing, as strings, the names of the columns to retain in the data tibble. Defaults to resid, and pred, which contain the residuals and predictions output by modelr::add_predictions().

...

additional arguments to be passed to downstream functions.

Value

the data tibble, with unnneded columns removed, and converted to long-form, with columns Temperature_norm, which_value (contents include "resid" and "pred"), and value.


taiawu/dsfworld_package documentation built on June 18, 2024, 5:39 a.m.