Learn R Programming

SCoRES (version 0.1.2)

fill_missing_with_reference: Fill missing variables in grid_df with reference values from df_fit

Description

Fill missing variables in grid_df with reference values from df_fit

Usage

fill_missing_with_reference(df_fit, grid_df, model_vars = NULL)

Value

grid_df with missing columns filled:

  • factor/ordered: reference = first level in df_fit

  • character: coerced to factor, reference = first unique value

  • numeric/integer: reference = numeric_ref (default 0)

Arguments

df_fit

A data frame used for model fitting. Character columns will be coerced to factors before alignment.

grid_df

A data frame of covariate settings (newdata) at which predictions/SCBs are to be evaluated.

model_vars

A vector contained all the interested columns that appear in df_fit. Only those variables are aligned in grid_df; other columns are left unchanged. Default is NULL.

Examples

Run this code
# Used internally by SCB_linear_outcome, SCB_logistic_outcome

Run the code above in your browser using DataLab