camr_descriptive_summary: Create Descriptive Summary of Data

View source: R/R07-Codebook.R

camr_descriptive_summaryR Documentation

Create Descriptive Summary of Data

Description

Function to generate descriptive summaries (means, percentages, ranges, etc.) of a variable that can then be passed to the descriptive_summary argument of the new_codebook_entry function.

Usage

camr_descriptive_summary(x, type, missing_values = NULL, digits = 2)

Arguments

x

A variable.

type

The type of summary to return, either continuous (mean, SD, etc.), categorical (percentages, etc.), or range (date ranges).

missing_values

An optional logical vector matching in length to x indicating missing data.

digits

The number of digits to round to.

Value

A list with two vectors: content with the summary statistics and additional_content with the labels for each type of statistic.

Author(s)

Kevin Potter

Examples

data( example_CAM_data_set )

example_CAM_data_set$INV.INT.HADS_anxiety |>
  camr_descriptive_summary( "continuous") |>
  data.frame()

example_CAM_data_set$SBJ.INT.Biological_sex |>
  camr_descriptive_summary( "categorical") |>
  data.frame()

example_CAM_data_set$SSS.DAT.Date_of_visit |>
  camr_descriptive_summary( "range") |>
  data.frame()


rettopnivek/camrprojects documentation built on March 26, 2024, 9:17 a.m.