Description Usage Arguments Value Author(s) See Also Examples
View source: R/splitFillCatFns.R
This is a generalisation of the splitByOrg
function and has in effect replaced it.
1 | splitByGroup(total.data, survData.total, groupCol = "lab_group")
|
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 |
A list of stratified survival data patient records arrays.
N Green
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
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.