ch.getDemographics: This function calculates summary statistics for demographic...

ch.getDemographicsR Documentation

This function calculates summary statistics for demographic data.

Description

Function that calculates summary statistics for demographic data.

Usage

ch.getDemographics(
  data,
  subjectColumn,
  ageColumn = NULL,
  sexColumn = NULL,
  genderColumn = NULL,
  ethnicityColumn = NULL,
  outputFileName = "demographics.txt",
  append = F,
  roundValue = 2
)

Arguments

data

A dataframe with the demographic information. It needs - at minimum - a subject column and one other of the specified columns.

subjectColumn

A string specifying the column of data that holds the subject identifier.

ageColumn

A string specifying the column of data that holds the age information. DEFAULT = NULL.

sexColumn

A string specifying the column of data that holds the sex information. DEFAULT = NULL.

genderColumn

A string specifying the column of data that holds the gender information. DEFAULT = NULL.

ethnicityColumn

A string specifying the column of data that holds the ethnicity information. DEFAULT = NULL.

outputFileName

A sting specifying the name of the output file that will contain the summary statistics. Default is "demographics.txt".

append

A boolean specifying whether to append to end of an existing file or to overwrite any existing file with the same name. DEFAULT = FALSE (overwrite).

roundValue

An integer that specifies how many digits the output should be rounded to. DEFAULT = 2. '

Value

nothing - a text file is saved.

Examples

ch.getDemographics (data, "sn", "age", genderColumn = "gender",outputFileName = "output.txt", append = T)

ccpluncw/ccpl_R_chutils documentation built on June 15, 2025, 3:03 a.m.