Execute a function or return a value if a column in present in a dataframe
Source:R/utils-dataframe.R
if_col_present.Rd
The simple use case. For more complex behaviour see switch_pipeline()
.
Arguments
- df
a dataframe
- col
a column name
- if_present
a
purrr
style function to execute on the dataframe if the column is present (or a plain value)- if_missing
a
purrr
style function to execute on the dataframe if the column is missing (or a plain value)
Value
either the value of if_present
/if_absent
or the result of calling
if_present
/if_absent
as functions on df
.