Dropping of columns from a data frame is simply used to remove the unwanted columns in the data frame. In this article, we will be discussing the two different approaches to drop columns by name from a given Data Frame in R.
The different approaches to drop columns by the name from a data frame is R language are discussed below
- Using subset()
Syntax: subset(df, expr) Parameters: df: Data frame used expr: Condition for a subset
- Using names()
Syntax: names(x) <- value Parameters: x: Object i.e. vector, matrix, data frame, etc. value: Names to be assigned to x