quantify_means_of_subgroup: Quantify Means of Subgroup

Description Usage Arguments Value Examples

Description

This function allows you to calculate mean and sd of a numeric variable by grouping and specific subgroup variable levels (ie. mean age of those belonging to subgroup 1 or 2 by levels of grouping variable)

Usage

1
2
quantify_means_of_subgroup(subgroup_m, mean_var, df, grouping_var,
  num_display = "PM", show_pval = TRUE, digits = 1)

Arguments

subgroup_m

Subgroup variable of interest (must be factor)

mean_var

Numeric variable from which to calculate mean and sd

df

Dataset containing covariates

grouping_var

Variable to group by (will be columns of table)

num_display

How should results be displayed? ('PM' for mean +- sd, 'PRS' for mean (sd))

show_pval

Logical. Should the p-value results be displayed?

digits

Number of digits to round decimals

Value

A data frame summarizing mean and sd of a numeric variable by grouping and specific subgroup variable levels

Examples

1
2
3
4
5
## Not run: 
quantify_means_of_subgroup(subgroup_m = Edu_4cat, mean_var = BMI, df = obpv_baseline,
grouping_var = obpv_quintile)

## End(Not run)

jjwillard/wfbmcphsr documentation built on May 14, 2019, 5:01 a.m.