I have a dataset that has "131" columns and I am trying to drop columns that are not needed for the analysis. Usually I drop the columns by writing the column names one by one. However, I am looking for a way to drop the columns in sequence such that I don't have to write each column's name.
In the data below, let's I am interested in dropping columns a to d. How can I do this using dplyr?
Dummy Data
a = c("a", "b", "c")
b = c("1", "2", "3")
c = c("a1", "b2", "c3")
d = c("F1", "F2", "F3")
e = c("A", "B", "C")
f = c("11", "22", "33")
g = c("A11", "B22", "C33")
Code
library(tidyverse)
df = data.frame(a, b, c, d, e, f, g)
# drop columns a to d
df = df %>% dplyr::.....