join_with_preds: Combine raw and modeled data

join_with_predsR Documentation

Combine raw and modeled data

Description

Use join_with_preds to combine raw data with the values predicted by a given model fit.

Usage

join_with_preds(
  tidied_for_tmas,
  by_var_fit,
  .join_by = ".var",
  .var_col = ".var",
  .model_name_col = "model_name",
  .fit_data_col = "data",
  .tidied_data_col = "data",
  .temp_col_raw = "Temperature",
  .value_norm_col_raw = "value_norm",
  .value_col_pred = "value",
  .keep_cols_from_raw = c("Temperature_norm", "value_norm"),
  .rescale_raw_temps = FALSE,
  ...
)

Arguments

tidied_for_tmas

a grouped, nested tibble, as returned by tidy_for_tmas

by_var_fit

a grouped, nested tibble, as returned by add_model_fits

.join_by

a string, giving the name of the column shared between tidied_for_tmas and by_var_fit, by which data can be mapped between the two. Should be renamed, since the final combination of the tibbles is done with bind_rows(), not join_by(). Defaults to ".var".

.var_col

a string, giving the name of the column shared between tidied_for_tmas and by_var_fit, which uniquely identifies each individual dataset. Defaults to ".var".

.model_name_col

a string, giving the name of the column in which the fitted model is specified by name (e.g. "model_1", "model_2" . . . ). Defaults to "model_name".

.fit_data_col

a string, giving the name of the column in by_var_fit containing nested tibbles of fitted data. Defaults to "data",.

.tidied_data_col

a string, giving the name of the column in tidied_for_tmas containing nested tibbles of raw data. Defaults to "data".

.temp_col_raw

a string, giving the name of the columns shared between tidied_for_tmas and by_var_fit, containing raw Temperatures. Defaults to "Temperature

.value_norm_col_raw

a string, giving the name of the column in tidied_for_tmas containing normalized RFU data.

.value_col_pred

a string, giving the name of the column in by_var_fit containing predicted and reconstructed values. Defaults to "value"

.keep_cols_from_raw

a character vector, containing names of the columns to be carried through into the final output tibble from tidied_for_tmas. Defaults to c("Temperature_norm", "value_norm").

.rescale_raw_temps

a boolean, defaults to FALSE, giving whether or not the supplied column name to .temp_col_raw should be normalized in a 0 to 1 range to match the always-normalized Temperature_norm used in fitting.

...

additional arguments, not passed to anything internal here, but allows for the function to recieve named arguments from upstream functions while ignoring arguments passed with ... which match nothing in this function.

Value

a tibble of five columns

  • .var character, giving the unique dataset identifier for each DSF trace.

  • Temperature_norm numeric, giving the normalized Temperature for a given value

  • value numeric, giving either the normalized raw RFU, a prediction from a fitted model to that normalized raw data, or individual component extract from the model prediction.

  • which_value character, describing which of the possible values types corresponding to a given value in the value column. e.g. "raw" (normalized raw RFU), "pred" (full model prediction), "resid" (residuals from the model prediction)

  • model_name character, giving the name of the model which was fit, and from which the predictions have been extracted. e.g. "model_1", "model_2" ... For the rows corresponding to raw data, modle_name is NA.


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