Skip to content
Prev 890 / 15274 Next

How to get values from dataframe's column conditional on other column

There's more than one way to do it.  My favorite:

df <- data.frame(X = c(0.12, -0.24, 0.34),
                  Y = c(TRUE, TRUE, FALSE))

subset(df, Y, X)