r data frame remove column by name code example
Example 1: drop a column in r data frame
df <- df %>%
select(-column_to_drop)
Example 2: r drop column by name
R> subset(df, select=-c(z,u))
x y
1 1 2
2 2 3
3 3 4
4 4 5
5 5 6
df <- df %>%
select(-column_to_drop)
R> subset(df, select=-c(z,u))
x y
1 1 2
2 2 3
3 3 4
4 4 5
5 5 6