Skip to main content
Cooper Levi
Choose A Good Heart Not a Good Face.
Asked a question 2 years ago

r how to subset data?

Where am I?

In answerQA you can ask and answer questions and share your experience with others!

Jaxon Axel
"Knowing other is Intelligence. Knowing yourself is wisdom. Mastering other is strength. Mastering our self is absolute power."

o combine multiple conditions to subset a data frame using ‘OR’, use the following:

my.data19.frame <- subset(data , V1 > 2 | V2 < 4)

You can also use the filter function from the dplyr package as follows:

library(dplyr) 

filter(data, V1 > 2 | V2 < 4)