if (require(ggplot2)) {
# generate the plot immediately
pairwise(lm(mpg ~ factor(am) + disp, data = mtcars), plot = TRUE)
# or save the object and plot it later
p <- pairwise(lm(mpg ~ factor(am) + disp, data = mtcars))
plot(p)
}
Run the code above in your browser using DataLab