I have a data frame as below:
structure(list(X1 = c(1, 0, 1, 0), X2 = c(0, 1, 1, 1), X3 = c(0, 0, 0, 1), Val = c(2, 3, 4, 5)), class = "data.frame"