diff --git a/R/tcplSubsetChid.R b/R/tcplSubsetChid.R index d71365d..f360dd5 100644 --- a/R/tcplSubsetChid.R +++ b/R/tcplSubsetChid.R @@ -92,9 +92,9 @@ tcplSubsetChid <- function(dat, flag = TRUE, type = "mc", export_ready = FALSE) } if (!"casn" %in% names(dat)) dat <- tcplPrepOtpt(dat) # for now we treat all >=.9 hitcall equally - dat[, hitc := hitc >= .9] - dat[, chit := mean(hitc[hitc %in% 0:1]) >= 0.5, by = list(aeid, chid)] - dat <- dat[hitc == chit | (is.na(chit) & (hitc == -1 | is.na(m4id)))] + dat[, actc := hitc >= .9] + dat[, chit := mean(actc[actc %in% 0:1]) >= 0.5, by = list(aeid, chid)] + dat <- dat[actc == chit | (is.na(chit) & (actc == -1 | is.na(m4id)))] dat[, fitc.ordr := NA_integer_]