I am trying to filter out all FALSE
entries in a dataframe I've created using the mtcars
dataset.
I have tried using filter
function but I do not understand it, and I've tried is.na
function but I couldn't get this to work.
Below is how I've created the dataframe
James_Test <- data.frame(rownames(mtcars), mtcars$mpg, mtcars$mpg > 15)
James_Test_names <- c("Model", "MPG", "MPG > 15")
colnames(James_Test) <- James_Test_names
head(James_Test, 7)
# Model MPG MPG > 15
# 1 Mazda RX4 21.0 TRUE
# 2 Mazda RX4 Wag 21.0 TRUE
# 3 Datsun 710 22.8 TRUE
# 4 Hornet 4 Drive 21.4 TRUE
# 5 Hornet Sportabout 18.7 TRUE
# 6 Valiant 18.1 TRUE
# 7 Duster 360 14.3 FALSE
I would like to be only left with the TRUE
result and none of the FALSE
entries.