subset drop column r code example
Example 1: how to drop a column in r
keeps <- c("y", "a")
DF[keeps]
Example 2: R drop columns
undesired <- c('mpg', 'cyl', 'hp')
mtcars <- mtcars %>%
select(-one_of(undesired))
keeps <- c("y", "a")
DF[keeps]
undesired <- c('mpg', 'cyl', 'hp')
mtcars <- mtcars %>%
select(-one_of(undesired))