This function deletes columns of a data.frame
by name.
Arguments
- df
[
data.frame
]
Adata.frame
.- column_names
[
character()
]
The name(s) of column(s) ofdf
to delete.
See also
Other data.frame helpers:
group_data.frame()
,
round_data.frame()
Examples
df <- data.frame("label" = c("A", "B"), "number" = 1:10)
delete_columns_data.frame(df = df, column_names = "label")
#> number
#> 1 1
#> 2 2
#> 3 3
#> 4 4
#> 5 5
#> 6 6
#> 7 7
#> 8 8
#> 9 9
#> 10 10
delete_columns_data.frame(df = df, column_names = "number")
#> label
#> 1 A
#> 2 B
#> 3 A
#> 4 B
#> 5 A
#> 6 B
#> 7 A
#> 8 B
#> 9 A
#> 10 B
delete_columns_data.frame(df = df, column_names = c("label", "number"))
#> data frame with 0 columns and 10 rows