
Jacob I. answered 08/20/19
Experienced Data Science Professional and Python Programmer
Hello,
I have generated some new data to answer this question, please see the below code with in line comments.
# 2 vectors to make up a dataframe
V1 <- c('a','b','c','d','e','f','g')
V2 <- c(1,2,3,4,5,6,7)
# Create the dataframe using the 2 vectors 'V1' and 'V2'
D1 <- data.frame(V1,V2)
# Create a vector with the values that you want to exclude, in this case it is 'b' and 'c'.
excluded_values <- c('b','c')
# Use the '!' operator to exclude values in the 'subset' argument for the function 'subset'
D2 <- subset(D1, !(V1 %in% excluded_values))
## The below code will accomplish the task for your example
excluded_values <- c('B','N','T')
D2 <- subset(D1, !(V1 %in% excluded_values))