How to Drop a Column from a Data Frame in R

· 1 min read · Updated March 15, 2026 · beginner
r data-frame dplyr data.table transformation

Dropping columns from a data frame is one of the most common data manipulation tasks in R.

With dplyr

Use select() with a negative sign to drop columns:

library(dplyr)

df <- data.frame(name = c("Alice", "Bob"), age = c(25, 30), score = c(85, 90))

df <- df %>% select(-score)
#   name age
# 1 Alice  25
# 2   Bob  30

Drop multiple columns:

df <- df %>% select(-score, -age)
#   name
# 1 Alice
# 2   Bob

You can also use where() to drop by condition:

df <- df %>% select(!where(is.numeric))

With base R

Set the column to NULL:

df$score <- NULL

Or use subsetting with negative indices:

df <- df[, -3]  # Drop third column
df <- df[, -c(2, 3)]  # Drop columns 2 and 3

Or by name:

df <- df[, !names(df) %in% c("score", "age")]

With data.table

Use := NULL to drop columns efficiently:

library(data.table)

dt <- data.table(name = c("Alice", "Bob"), age = c(25, 30), score = c(85, 90))
dt[, score := NULL]
#    name age
# 1: Alice  25
# 2:   Bob  30

Drop multiple columns:

dt[, c("score", "age") := NULL]

See Also

  • select() — Select and rename columns in dplyr
  • data.frame — Base R data frame documentation