Skip to main content
Maverick Noah
High hopes get Higher vibes
Asked a question 2 years ago

how to create subset in r?

Where am I?

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

Charles Eli
I Don't want a perfect life. I want a happy life.

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

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

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


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