select | R Documentation |
Select or drop columns from a data.table
select(.df, ...)
.df |
A data.frame or data.table |
... |
Columns to select or drop.
Use named arguments, e.g. new_name = old_name, to rename selected variables.
|
df <- data.table(
x1 = 1:3,
x2 = 1:3,
y = c("a", "b", "c"),
z = c("a", "b", "c")
)
df %>%
select(x1, y)
df %>%
select(x1:y)
df %>%
select(-y, -z)
df %>%
select(starts_with("x"), z)
df %>%
select(where(is.character), x1)
df %>%
select(new = x1, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.