fullSummary: Compute a complete set of summary statistics for continuous...

fullSummaryR Documentation

Compute a complete set of summary statistics for continuous variables

Description

Compute a complete set of summary statistics for continuous variables

Usage

fullSummary(
  data,
  value = value,
  domain = domain,
  test = test,
  arm = arm,
  visit = visit,
  ci = FALSE,
  pvalue = FALSE,
  pvalue.digits = 4,
  approx = "t",
  alpha = 0.05,
  geometric = FALSE,
  zeros = NULL
)

Arguments

data

A data.frame containing numeric values and columns for visit and arm, and optionally containing columns for domain and test.

value, domain, test, arm, visit

Unquoted names of columns in data to be used in summarizing. They all default to their own names.

ci

Whether to report the 95 mean. Defaults to ci = FALSE.

pvalue

Whether to report the p-value for the mean being different from zero. Almost always, this will be purely descriptive because comparison to baseline is not the point of a clinical trial.

pvalue.digits

The number of decimal places at which to round and format p-values. Defaults to pvalue.digits = 4. To avoid formatting, specify pvalue.digts = NULL.

geometric

Whether to report the geometric rather than arithmetic mean (and confidence interval). Defaults to geometrci = FALSE.

zeros

If geometric means are required but the data contain 0s, the user needs to tell the function what to do: either zeros = "add1" will use log1p instead of log; zeros = "omit" will use the logs, omitting any -Inf values from the calculations. No default is provided because the user needs to know there 0s are there, and how to deal with them is arbitrary.

Details

Note that if 'domain' and 'test' do not exist, they will be set to empty strings. If you want a table of all baseline values, not split by arm, you need to filter down to the correct visit and replace arm with a single value before calling this function. Also NOTE THAT you need to ensure BEFOREHAND that missing values are properly included (possibly via dplyr::complete). The confidence interval is fixed (currently) at 95 approximation.

Value

A data frame.

Note

In a sane world, you'd add another line to the pipeline and remove Mean and SD. Also, I ought to write kable and formattable methods. Earlier versions (prior to 2019-05-22) used strings as all arguments but the first. However, dplyr is getting noiser about that, so I switched. I've added computation of intervals and p-values: I don't like it, but keep getting asked and it's better to build it in so that it can be properly tested, rather than do it on the fly and risk making mistakes.


harrysouthworth/render documentation built on May 31, 2024, 11:18 a.m.