I want to draw an interaction.plot for my data.
with(data, interaction.plot(biofeedback, diet, as.numeric(drug),
xlab="Biofeedback", ylab="Drug", ylim = c(0, 4), col = 2:3))
Result:
But clearly that's not correct because my data is:
##    biofeedback    diet drug pressure
## 1      present  absent    1      170
## 2      present  absent    1      175
## 3      present  absent    1      165
...
## 7      present present    1      161
## 8      present present    1      173
## 9      present present    1      157
...
## 19     present present    2      164
## 20     present present    2      166
## 21     present present    2      159
...
This data has different drugs for absent and present Biofeedback for present diet. And it has some drugs for absent diet. None of this shows on the plot. Why?
dput(data) 
## structure(list(biofeedback = structure(c(2L, 2L, 2L, 2L, 2L, 
## 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
## 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 
## 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
## 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
## 1L, 1L, 1L), .Label = c("absent", "present"), class = "factor"), 
##     diet = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
##     2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 
##     1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
##     1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
##     2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
##     2L, 2L), .Label = c("absent", "present"), class = "factor"), 
##     drug = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
##     1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 
##     3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 
##     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
##     2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
##     3L, 3L), .Label = c("1", "2", "3"), class = "factor"), pressure = c(170L, 
##     175L, 165L, 180L, 160L, 158L, 161L, 173L, 157L, 152L, 181L, 
##     190L, 186L, 194L, 201L, 215L, 219L, 209L, 164L, 166L, 159L, 
##     182L, 187L, 174L, 180L, 187L, 199L, 170L, 204L, 194L, 162L, 
##     184L, 183L, 156L, 180L, 173L, 173L, 194L, 197L, 190L, 176L, 
##     198L, 164L, 190L, 169L, 164L, 176L, 175L, 189L, 194L, 217L, 
##     206L, 199L, 195L, 171L, 173L, 196L, 199L, 180L, 203L, 202L, 
##     228L, 190L, 206L, 224L, 204L, 205L, 199L, 170L, 160L, 179L, 
##     179L)), .Names = c("biofeedback", "diet", "drug", "pressure"
## ), row.names = c(NA, -72L), class = "data.frame")

 
    