В базе R мы можем сделать
boxplot(sapply(df[-1], function(x) df$val[as.logical(x)]))
Или используя ggplot2
df.r <- do.call(rbind, lapply(names(df)[-1], function(x)
data.frame(x, y=df$val[as.logical(df[,x])])))
library(ggplot2)
ggplot(df.r, aes(x=x, y=y)) + geom_boxplot(aes(fill=y))
Данные
df <- structure(list(val = c(1.37095844714667, -0.564698171396089,
0.363128411337339, 0.63286260496104, 0.404268323140999, -0.106124516091484,
1.51152199743894, -0.0946590384130976, 2.01842371387704, -0.062714099052421
), var1 = c(1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L), var2 = c(1L,
1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 1L), var3 = c(0L, 0L, 0L, 1L,
0L, 1L, 1L, 1L, 1L, 1L)), class = "data.frame", row.names = c(NA,
-10L))