Skip to contents

Generates a contingency table describing severity distributions of mental health conditions.

Usage

make_severity_contingency(
  data_tb,
  logic_vals_chr = c("Yes", "No"),
  missing_1L_dbl = 1,
  other_1L_chr = "NotApplicable",
  output_1L_chr = c("tbl_df", "data.frame", "data.table"),
  parent_1L_chr = "MentalHealthCondition",
  rows_int = 26:28,
  scale_by_1L_dbl = 10,
  sex_ls = list(SEXP = c("Females", "Males")),
  target_1L_chr = "Severity"
)

Arguments

data_tb

Input severity dataset.

logic_vals_chr

Labels representing positive and negative states.

missing_1L_dbl

Count assigned to non-applicable categories.

other_1L_chr

Label assigned to non-applicable records.

output_1L_chr

Output type.

parent_1L_chr

Parent condition variable.

rows_int

Rows to retain from the input dataset.

scale_by_1L_dbl

Scaling factor used when converting proportions to counts.

sex_ls

Mapping of sex labels.

target_1L_chr

Name of the generated severity variable.

Value

A contingency table containing severity distributions.

Details

The resulting table can be used to add severity classifications to a synthetic population using ReplicaAdder().

Examples

if (FALSE) { # \dontrun{
severity_dt <- make_severity_contingency(
  severity_tb,
  output_1L_chr = "data.table"
)
} # }