source("http://192.38.117.59/~linearpredictors/datafiles/readCsl.R") ## table of treatment and ascites t1 <- xtabs(~ tment + asc, data = csl) t1 <- addmargins(t1) ## same table, but on the subset of data where dc = 1 t2 <- xtabs(~ tment + asc, data = subset(csl, dc==1)) t2 <- addmargins(t2) ## now for each cell in the table we find the percentage of ## events t2/t1*100