Top "Subset" questions

A subset consists of those elements selected from a larger set of elements, by their position in the larger set or other features, such as their value.

How to drop columns by name in a data frame

I have a large data set and I would like to read specific columns or drop all the others. data &…

r dataframe subset
Opposite of %in%: exclude rows with values specified in a vector

A categorical variable V1 in a data frame D1 can have values represented by the letters from A to Z. …

r dataframe subset
Filter data.frame rows by a logical condition

I want to filter rows from a data.frame based on a logical condition. Let's suppose that I have data …

r dataframe subset r-faq
Selecting data frame rows based on partial string match in a column

I want to select rows from a data frame based on partial match of a string in a column, e.…

r regex string match subset
Subset of rows containing NA (missing) values in a chosen column of a data frame

We have a data frame from a CSV file. The data frame DF has columns that contain observed values and …

r csv dataframe subset na
Undefined columns selected when subsetting data frame

I have a data frame, str(data) to show more about my data frame the result is the following: > …

r dataframe subset
Extract a subset of a dataframe based on a condition involving a field

I have a large CSV with the results of a medical survey from different locations (the location is a factor …

r dataframe subset r-faq
Select rows from a data frame based on values in a vector

I have data similar to this: dt <- structure(list(fct = structure(c(1L, 2L, 3L, 4L, 3L, 4L, 1…

r subset r-faq
subsetting a Python DataFrame

I am transitioning from R to Python. I just began using Pandas. I have an R code that subsets nicely: …

python pandas subset
How can I subset rows in a data frame in R based on a vector of values?

I have two data sets that are supposed to be the same size but aren't. I need to trim the …

r subset r-faq