Skip to main content
Adam Ian
I Help Businesses Drive Growth by Hiring Great Talent Using Technology
Asked a question 2 years ago

how to subset columns in r?

Where am I?

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

William Boon
Age: 15-26 The age where you meet a lot of temporary people.

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)