int.plot {Conigrave} | R Documentation |
Interaction plot
Description
Calculates a standardized two way or three way interaction and plots using ggplot2.
Usage
int.plot(data, outcome, predictor, moderator, y.lim = c(-1, 1),
x.lim = c(-1, 1), x.lab = "auto", y.lab = "auto", title = "auto",
title.size = 15, SDs = 1, legend.name = "auto",
colour = "ghostwhite", show.points = FALSE, save = F,
path = getwd())
Arguments
data |
an object of class 'data.frame' or 'imputationList'. |
outcome |
a string with the name of the outcome variable. |
predictor |
a string with the name of the predictor variable. |
moderator |
a vector of the names of up to two moderating variables. |
y.lim |
vector of numerals indicating y axis bounds. |
x.lim |
vector of numerals indicating x axis bounds. |
x.lab |
a string with the label of the x axis. |
y.lab |
a string with the label of the y axis. |
title |
a string containing title text. |
title.size |
a numeral containing the font size of the title. |
SDs |
a numeral indicating the standard deviations of the moderators. |
legend.name |
a character string indicating the title of the legend. |
colour |
a character string containing the colour of the data points. |
show.points |
logical to determine whether or not to include points. |
save |
logical as to whether or not to save the plot. |
path |
string containing path of where to save plot. Defaults to working directory. |
Value
A ggplot
Examples
carsdata<-mtcars
int.plot(carsdata,"mpg","disp","cyl", y.lim = c(-2.5,2.5))
int.plot(carsdata,"mpg","disp", c("cyl","am"), y.lim = c(-5.0,2.0))