splitByGroup: Split patient record data in subsets which all contain all...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/splitFillCatFns.R

Description

This is a generalisation of the splitByOrg function and has in effect replaced it.

Usage

1
splitByGroup(total.data, survData.total, groupCol = "lab_group")

Arguments

total.data

The complete combined raw data.

survData.total

The complete survival data format array with multiple same-patient in-hospital infection records retained.

groupCol

The field name to split into lists by. Currently use lab_group for organism stratification, Gram, CombinedMET or VAN.

Value

A list of stratified survival data patient records arrays.

Author(s)

N Green

See Also

splitByOrg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
##---- 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 (total.data, survData.total, groupCol = "lab_group") 
{
    survDataByGroup <- list()
    namesGroup <- as.character(unique(total.data[!is.na(total.data[, 
        groupCol]), groupCol]))
    for (name in namesGroup) {
        groupRows <- (total.data[, groupCol] == name & total.data$infstatus == 
            1) | total.data$infstatus == 0
        groupRows[is.na(groupRows)] <- FALSE
        uniqueGroupRows <- rmOrganism(total.data[groupRows, ])
        survDataByGroup[[name]] <- survData.total[groupRows, 
            ][uniqueGroupRows, ]
    }
    survDataByGroup
  }

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