summary_df: Summarise with mode for factors and mean/median for numeric...

View source: R/ff_newdata.R

summary_dfR Documentation

Summarise with mode for factors and mean/median for numeric variables

Description

When producing conditional estimates from a regression model, it is often useful to set variables not of interest to their mode for factors and mean or median for numerics when creating the newdata object.

Usage

summary_df(.data, cont = "mean")

Arguments

.data

A data frame or tibble.

cont

One of "mean" or "median": the summary estimate for continuous variables.

Value

A data frame or tibble with the mode for factors and mean/median for continuous variables.

See Also

ff_mode ff_expand

Examples

library(dplyr)
colon_s %>% 
  select(age, sex.factor, obstruct.factor, perfor.factor) %>% 
  summary_df()
  
  colon_s %>% 
    select(age, sex.factor, obstruct.factor, perfor.factor) %>% 
    summary_df(cont = "median")

finalfit documentation built on Sept. 11, 2024, 9:01 p.m.