Let say I have below data frame
set.seed(100)
DF = data.frame(col1 = 1:10, col2 = sample(letters[1:10], 10))
Let define a vector
vec = c("c", "a", "b")
Now I want to split above DF
based on the values of the col2
. Means, in the first part I will have all values of col2
that are in vec
, and in the second part the remaining part.