Displaying 1 result from an estimated 1 matches for "diseasecod".
Did you mean:
diseasecodes
2007 Jul 16
0
FW: summary statistics for groups
...s a try:
# setup some fake data as an example
icd9 <- c(rep("dis1",4), rep("dis2",5), rep("dis3",3))
n <- length(icd9)
exposure <- rnorm(n)
working <- data.frame(icd9, exposure)
# get some useful things together
numDis <- length(levels(working$icd9))
diseaseCodes <- levels(working$icd9)
# capture results in here
results <- data.frame(ICD9code=diseaseCodes, ave_exposure=rep(NA,
numDis), ICD9count=rep(NA, numDis), other_ave=rep(NA, numDis),
other_Ct=rep(NA, numDis))
for(k in 1:numDis){
working$indicator <- ifelse(working$icd9==diseaseCodes[k...