You can use the !
operator to basically make any TRUE FALSE and every FALSE TRUE. so:
D2 = subset(D1, !(V1 %in% c('B','N','T')))
EDIT:
You can also make an operator yourself:
'%!in%' <- function(x,y)!('%in%'(x,y))
c(1,3,11)%!in%1:10
[1] FALSE FALSE TRUE
More Related Contents:
- Filter data.frame rows by a logical condition
- Subset data frame based on number of rows per group
- How to drop columns by name in a data frame
- Subset / filter rows in a data frame based on a condition in a column
- How do I extract a single column from a data.frame as a data.frame?
- Subset dataframe by multiple logical conditions of rows to remove
- Filtering a data frame on a vector [duplicate]
- Subset data frame based on multiple conditions [duplicate]
- Subset of rows containing NA (missing) values in a chosen column of a data frame
- dplyr – filter by group size
- How to subset data in R without losing NA rows?
- Using grep to help subset a data frame
- Filter data frame rows based on values in vector
- Selecting columns in R data frame based on those *not* in a vector
- Return df with a columns values that occur more than once [duplicate]
- Undefined columns selected when subsetting data frame
- Select the first row by group
- Calculate the mean of every 13 rows in data frame
- Calculate row means on subset of columns
- How does one reorder columns in a data frame?
- R spreading multiple columns with tidyr [duplicate]
- Take random sample by group
- How do I delete rows in a data frame?
- Replacing values from a column using a condition in R
- Split data.frame by value
- subset a column in data frame based on another data frame/list
- Remove columns from dataframe where some of values are NA
- Check whether values in one data frame column exist in a second data frame
- How do you remove columns from a data.frame?
- DT[!(x == .)] and DT[x != .] treat NA in x inconsistently