twoway.plots: Exploratory Graphs for Two Factor Designs

Description Usage Arguments Author(s) See Also Examples

View source: R/twowayplots.R

Description

Function creates side-by-side boxplots for each factor, a design plot (means), and an interaction plot.

Usage

1
twoway.plots(Y, fac1, fac2, COL = c("#A9E2FF", "#0080FF"))

Arguments

Y

response variable

fac1

factor one

fac2

factor two

COL

a vector with two colors

Author(s)

Alan T. Arnholt <arnholtat@appstate.edu>

See Also

oneway.plots, checking.plots

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
with(data = TIREWEAR, twoway.plots(wear, treat, block))
#################################
## Similar graphs with ggplot2 ##
#################################
p1 <- ggplot(data = TIREWEAR, aes(x = treat, y = wear, fill = treat)) +
geom_boxplot() + guides(fill = FALSE) + theme_bw()
p2 <- ggplot(data = TIREWEAR, aes(x = block, y = wear, fill = block)) +
geom_boxplot() + guides(fill = FALSE) + theme_bw() 
p3 <- ggplot(data = TIREWEAR, aes(x = treat, y = wear, color = block,
group = block)) + stat_summary(fun.y = mean, geom = "point", size = 4) + 
stat_summary(fun.y = mean, geom = "line") + theme_bw()
p4 <- ggplot(data = TIREWEAR, aes(x = treat, y = wear, color = treat)) + 
geom_boxplot() + facet_grid(. ~ block) +theme_bw()
p1
p2
p3
p4
## To get all plots on the same device use gridExtra (not run)
## library(gridExtra)
## grid.arrange(p1, p2, p3, p4, nrow=2)

PASWR2 documentation built on Sept. 5, 2021, 5:44 p.m.