Skip to contents

Get started

To get started, let’s load the package into our working session:

If you have not downloaded it yet from our private github repo, please see the Readme on the package home page.

This vignette was created to help guide and inspire additional functionality for the tidycoRe package.

Calculating standardized differences with format_tableby()

TidycoRe also provides functionality to calculate standardized differences between the groups specified in addition to the arsenal::tableby statement for continuous and categorical variables. Standardized differences are calculating using Cohen’s D function.

To implement the standardized differences in your tableby formatting, you can set the standardized_diff argument to TRUE.

See the example below:

demo_tableby <- tableby(
  female ~
    age +
    white +
    hispanic +
    insurance_private +
    insurance_medicare +
    insurance_medicaid +
    insurance_none,
  cat.stats = c("countpct"),
  numeric.stats = c("N", "meanCI", "meansd"),
  test = TRUE,
  data = demo_data
)

format_tableby(
  tableby_data = demo_tableby,
  condense = TRUE, 
  effect_sizes = TRUE
) %>% 
format_tableby_flextable()

Calculating (modified CorEvitas) MCCI calculations using mcci_calc

TidycoRe has built in functionality to calculate the MCCI based on the registry you are working on (designed by the registry leads). The function mcci_calc() will return a vector of MCCI values for each row in the dataset.

You can use it with tidyverse:

data %>% 
  mutate(
    mcci = mcci_calc(registry = "pso", data = (.))
  )

or by itself:

data$mcci = mcci_calc(registry = "pso", data = data)