# NOT RUN {
## variable names in the input data.frame aeanonym
## RAND treatment as randomized
## PREF adverse event symptom name
## SN number of patients in treatment group
## SAE number of patients in each group for whom the event PREF was observed
## OrgSys Organ System
##
## Input sort order is PREF/RAND
data(aeanonym)
head(aeanonym)
## variable names are hard-wired in the program
## names(aeanonym) <- c("RAND", "PREF", "SAE", "SN", "OrgSys")
## Calculate log relative risk and confidence intervals (95<!-- % by default). -->
## AElogrelrisk sets the sort order for PREF to match the relative risk.
aeanonymr <- AElogrelrisk(aeanonym) ## PREF sorted by relative risk
head(aeanonymr)
class(aeanonymr$PREF)
levels(aeanonymr$PREF)
AEdotplot(aeanonym)
AEdotplot(aeanonym, sort=FALSE)
AEdotplot(aeanonym, conditionVariable=aeanonym$OrgSys)
aefake <- rbind(cbind(aeanonym, group="ABC"), cbind(aeanonym, group="DEF"))
aefake$SAE[67:132] <- sample(aefake$SAE[67:132])
aefake$OrgSys.group <- with(aefake, interaction(OrgSys, group))
## fake 2
KEEP <- aefake$OrgSys %in% c("GI","Resp")
<!-- %% KEEP <- aefake$OrgSys %in% c("GI","Resp") -->
AEfakeGR <- AEdotplot(aefake[KEEP,], conditionVariable=aefake$OrgSys.group[KEEP],
sub=list("ABC and DEF have different sort orders for PREF", cex=.7))
AEfakeGR ## ABC and DEF have different sort orders for PREF
AEfakeGR1 <- AEdotplot(aefake[KEEP & (1:132) <= 66,],
conditionVariable=aefake$OrgSys.group[KEEP & (1:132) <= 66])
AEfakeGR2 <- AEdotplot(aefake[KEEP & (1:132) >= 67,],
conditionVariable=aefake$OrgSys.group[KEEP & (1:132) >= 67])
AEfakeGR1
AEfakeGR2
AEfakeMatched <- AEmatchSortorder(AEfakeGR1, AEfakeGR2)
update(do.call(c, AEfakeMatched),
main="ABC sorted by Relative Risk; DEF matches ABC order")
# }
# NOT RUN {
## Please see ?AEdotplot for examples using the formula method
##
## Many more examples are in demo("AEdotplotManyExamples")
# }
Run the code above in your browser using DataLab