The R Project SVN R

Rev

Rev 77594 | Rev 81938 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 77594 Rev 79479
Line 93... Line 93...
93
  rowpos <- factor(rowpos,
93
  rowpos <- factor(rowpos,
94
                   levels = sort.list(tapply(decrease, rowpos, mean)))
94
                   levels = sort.list(tapply(decrease, rowpos, mean)))
95
  interaction.plot(rowpos, treatment, decrease, col = 2:9, lty = 1)
95
  interaction.plot(rowpos, treatment, decrease, col = 2:9, lty = 1)
96
})
96
})
97
 
97
 
-
 
98
%% FIXME esoph
98
with(esoph, {
99
%% with(esoph, {
99
  interaction.plot(agegp, alcgp, ncases/ncontrols, main = "'esoph' Data")
100
%%   interaction.plot(agegp, alcgp, ncases/ncontrols, main = "'esoph' Data")
100
  interaction.plot(agegp, tobgp, ncases/ncontrols, trace.label = "tobacco",
101
%%   interaction.plot(agegp, tobgp, ncases/ncontrols, trace.label = "tobacco",
101
                   fixed = TRUE, xaxt = "n")
102
%%                    fixed = TRUE, xaxt = "n")
102
})
103
%% })
103
## deal with NAs:
104
%% ## deal with NAs:
104
esoph[66,] # second to last age group: 65-74
105
%% esoph[66,] # second to last age group: 65-74
105
esophNA <- esoph; esophNA$ncases[66] <- NA
106
%% esophNA <- esoph; esophNA$ncases[66] <- NA
106
with(esophNA, {
107
%% with(esophNA, {
107
  interaction.plot(agegp, alcgp, ncases/ncontrols, col = 2:5)
108
%%   interaction.plot(agegp, alcgp, ncases/ncontrols, col = 2:5)
108
                                # doesn't show *last* group either
109
%%                                 # doesn't show *last* group either
109
  interaction.plot(agegp, alcgp, ncases/ncontrols, col = 2:5, type = "b")
110
%%   interaction.plot(agegp, alcgp, ncases/ncontrols, col = 2:5, type = "b")
110
  ## alternative take non-NA's  {"cheating"}
111
%%   ## alternative take non-NA's  {"cheating"}
111
  interaction.plot(agegp, alcgp, ncases/ncontrols, col = 2:5,
112
%%   interaction.plot(agegp, alcgp, ncases/ncontrols, col = 2:5,
112
                   fun = function(x) mean(x, na.rm = TRUE),
113
%%                    fun = function(x) mean(x, na.rm = TRUE),
113
                   sub = "function(x) mean(x, na.rm=TRUE)")
114
%%                    sub = "function(x) mean(x, na.rm=TRUE)")
114
})
115
%% })
115
rm(esophNA) # to clear up
116
%% rm(esophNA) # to clear up
116
}
117
}
117
\keyword{hplot}
118
\keyword{hplot}