validate_data: Validate Data for ALARM

View source: R/validate.R

validate_dataR Documentation

Validate Data for ALARM

Description

validate_data is used to ensure all of the predictors are in the expected format before making predictions. This function is called internally by predictALARM().

Usage

validate_data(data)

Arguments

data

A data.frame with the following numeric columns, in any order:

  • age - Age (years)

  • sex - Sex (0 = Man, 1 = Woman)

  • fhx_cancer - Family history of any cancer? (0 = No, 1 = Yes)

  • phx_cancer - Personal history of cancer? (0 = No, 1 = Yes)

  • fev1fvc - FEV1 / FVC (percent, between 0 and 100)

  • phx_lungdx - Personal history of COPD? (0 = No, 1 = Yes)

  • hhinc - Annual household income (see Details section)

  • bmi - Body Mass Index (kg/m^2)

  • smk_status - Smoking status (1 = Never, 1 = Former, 3 = Current)

  • smk_duration - Smoking duration (years)

  • smk_cigpday - Smoking intensity (avg. # of cigarettes per day)

Details

Total annual household income (hhinc) is a categorical variable with six levels:

  • ⁠0 = < 2,500 yuan⁠

  • ⁠1 = 2,500-4,999 yuan⁠

  • ⁠2 = 5,000-9,999 yuan⁠

  • ⁠3 = 10,000-19,999 yuan⁠

  • ⁠4 = 20,000-34,999 yuan⁠

  • ⁠5 = >= 35,000 yuan⁠

Value

Throws an informative error if data are invalid, otherwise nothing.

Examples

data <- data.frame(age = 70, sex = 1, fhx_cancer = 1,
                   phx_cancer = 0, fev1fvc = 70, phx_lungdx = 1,
                   hhinc = 3, bmi = 30, 
                   smk_status = c(1, 2), smk_duration = c(NA, 40), 
                   smk_cigpday = c(NA, 20))
validate_data(data)


mattwarkentin/ALARM documentation built on July 16, 2025, 3:53 p.m.