I am trying to create a boxplot where on the x axis there is a binary 1/2 variable. When I create my boxplot and the loop using ggplot I just get one big boxplot that is centered at 1.5 when instead I want a boxplot at 1 and a boxplot at 2. I am new to this so any help and additional reading would be appreciated. Below is the code.
myboxplot <- function(mydata=ivf_dataset, myexposure, myoutcome )
{
bp <- ggplot(mydata, aes_(as.name(myexposure), as.name(myoutcome))) +
geom_boxplot()
print(bp)
}
myboxplot(myexposure = "ART_CURRENT", myoutcome = "H19_DMR_mean")