Learn R Programming

framecleaner (version 0.2.1)

select_otherwise: select_otherwise

Description

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.

Usage

select_otherwise(
  .data,
  ...,
  otherwise = NULL,
  col = NULL,
  return_type = c("names", "index", "df")
)

Value

integer vector by default. possibly data frame or character vector

Arguments

.data

dataframe

...

tidyselect. columns to choose

otherwise

tidyselect. default columns to choose if ... is not specified

col

tidyselect. column to choose regardless of ... or otherwise specifications

return_type

choose to return column index, names, or df. defaults to index

Examples

Run this code

iris %>%
select_otherwise(where(is.double), return_type = "index")

Run the code above in your browser using DataLab