flexible select operator that powers the tidy consultant universe. Used to set sensible defaults and flexibly return the chosen columns. A developer focused function, but may be useful in interactive programming due to the ability to return different types.
select_otherwise(
.data,
...,
otherwise = NULL,
col = NULL,
return_type = c("names", "index", "df")
)
dataframe
tidyselect. columns to choose
tidyselect. default columns to choose if ... is not specified
tidyselect. column to choose regardless of ... or otherwise specifications
choose to return column index, names, or df. defaults to index
integer vector by default. possibly data frame or character vector
iris %>%
select_otherwise(where(is.double), return_type = "index")
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> 1 2 3 4