A safe column selector for use in downstream API wrapper functions.
Unlike dplyr::select(), this passes non-tibble objects through
unchanged, which is useful when a parse function may return either a
tibble or a raw list depending on the response format.
Usage
spdgt_select(df, select_arg = NULL)
Arguments
- df
a tibble from which columns will be selected
- select_arg
a character vector of column names to select
Value
an object of the same class as was passed to the function
Details
When an object that does not inherit from tbl_df is passed, it is
returned without further action.
Examples
if (FALSE) { # \dontrun{
spdgt_select(tibble::as_tibble(mtcars), c("mpg", "cyl"))
# Non-tibble input is returned unchanged
spdgt_select(mtcars, c("mpg", "cyl"))
} # }