which_cols | R Documentation |
Given a vector of column names or numbers, return the corresponding column indices.
which_cols(x, .data)
x |
|
.data |
|
numeric
A vector of column indices.
df <- data.frame(A = 1:3, B = 4:6, C = 7:9)
which_cols(c("A", "B"), df) # Returns: 1 2
which_cols(c(1, 3), df) # Returns: 1 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.