How do I plot two variables box plots side by side using ggplot2 and/or boxplot()
generate data
#generate data
var1<- c(11.5,45,33,67,89,12,5)
var2<- c(23,45,66.7,33,42,88,1)
var3<- c(12,13,14,15.8,16,11,10)
case<- c(1,2,3.4,4,5,6.1,7)
dframe<- as_tibble(cbind(case,var1, var2, var3))
the problem I am facing is that when I use boxplot() and lable the x axis all the lables are stacked
boxplot(var1, var2, var3,
xlab= c("var1", "var2"))
whem I use ggplot2: I get a warningand the graph shows just one box plot.
ggplot(dframe, aes(var1, var2, var3))+
geom_boxplot()
Warning message: Continuous x aesthetic -- did you forget aes(group=...)?