r dataframe remove columns code example
Example 1: r data frame remove column
df$columnName <- NULL
Example 2: R drop columns
undesired <- c('mpg', 'cyl', 'hp')
mtcars <- mtcars %>%
select(-one_of(undesired))
df$columnName <- NULL
undesired <- c('mpg', 'cyl', 'hp')
mtcars <- mtcars %>%
select(-one_of(undesired))