例如,这有效:
library("vcd")
library("vcdExtra")
ppp1 <- Arthritis[,-1]
ppp1 <- ppp1 [,-3]
colnames(ppp1)[1] <- "Dose"
colnames(ppp1)[3] <- "Symptoms"
ppp1$Symptoms <- ordered(ppp1$Symptoms,
levels = c("None", "Some", "Marked"),
labels = c(">2", "1-2", "<1"))
ppp1$Dose <- ordered(ppp1$Dose,
levels = c("Placebo","Treated"),
labels = c("<= 1", ">=2"))
tab1 <- xtabs(~Symptoms+Sex+Dose, data=ppp1)
mosaic(tab1)
但这会产生错误:
ppp2<- Arthritis[,-1]
ppp2 <- ppp2 [,-3]
colnames(ppp2)[1] <- "Dose"
colnames(ppp2)[3] <- "Symptoms"
ppp2$Symptoms <- ordered(ppp2$Symptoms,
levels = c("None", "Some", "Marked"),
labels = c(">2", "1-2", "<1"))
ppp2$Dose <- ordered(ppp2$Dose,
levels = c("Placebo","Treated"),
labels = c("\u2264 1", "\u2265 2"))
tab2 <- xtabs(~Symptoms+Sex+Dose, data=ppp2)
mosaic(tab2)
grid.Call.graphics 中的错误(C_downviewport,name$name,strict):
未找到视口“cell:Symptoms=<1,Sex=Male,Dose=≥2”
任何想法将不胜感激。