Description Usage Arguments Author(s) See Also Examples
Remove patient records for the same patient-stay where one or more of the records have duplicate or missing entries.
1 | rmDuplicates(total.data, subrows)
|
total.data |
Complete combined patient record data set. |
subrows |
Row names of subset of patient records on which to apply function. |
N Green
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ##---- 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, subrows)
{
inc.ind <- hos.ind <- rep(TRUE, nrow(total.data))
inc.ind[subrows] <- total.data$hes_dischargeddeadoralive[subrows] %in%
c("Death", "Live")
hos.ind[subrows] <- total.data$hes_dismethdescription[subrows] %in%
c("Not applicable patient still in hospital", "Not known")
if (any(inc.ind[subrows])) {
total.data <- rmAllButOne(inc.ind, subrows, total.data)
}
else if (all(hos.ind[subrows])) {
if (any(!is.na(total.data$hes_disdte[subrows]))) {
hos.ind[subrows] <- total.data$hes_disdt[subrows] ==
max(total.data$hes_disdte[subrows], na.rm = TRUE)
}
total.data <- rmAllButOne(hos.ind, subrows, total.data)
}
total.data
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.