AgeCatModify: Age category modification

Description Usage Arguments Details Author(s) Examples

View source: R/hospCodesFns.R

Description

Find which corresponding age category in the guidelines are the patients in the LabBase2 database.

Usage

1
AgeCatModify(inf.data)

Arguments

inf.data

Infected patient data.

Details

Find which corresponding age category in the guidelines are the patients in the LabBase2 database. The age categories different in guidelines and databases so need to regroup and relabel.

7001: 48 hours old; 7002-7003: 48 hours - 1 month old; 7004-7007 and 1-18: 1 month - 18 years old; 19-200: Over 18 years old

Author(s)

N Green

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (inf.data) 
{
    patient.age_cat <<- cut(inf.data[, "hes_ageatstartofepisode"], 
        breaks = c(0, 18, 200, 7001.5, 7003.5, 7008))
    patient.age_cat <- factor(patient.age_cat, c("(200,7002]", 
        "(7002,7004]", "(7004,7008]", "(0,18]", "(18,200]"))
    patient.age_cat[patient.age_cat == "(0,18]"] <- "(7004,7008]"
    patient.age_cat <- droplevels(patient.age_cat)
    levels(patient.age_cat) <- 1:4
    patient.age_cat
  }

n8thangreen/HESmanip documentation built on March 21, 2020, 12:20 a.m.