Skip to main content
Nolan Liam
Do those things which makes you feel beautiful
Asked a question 5 months ago

r how to subset data?

Where am I?

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

Robert David
Today I accept that for some people, I may be too much or too little. But for the people who deserve me, I am just right.

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

my. data.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)