add_col_if_missing: Add default-value columns to a dataframe

Description Usage Arguments Value Examples

View source: R/extract-helpers.R

Description

Add default-value columns to a dataframe

Usage

1

Arguments

df

a dataframe

...

key-value pairs. The lefthand side should be the name of the desired column and the righthand should be the value to use as a default.

Value

the dataframe is returned. If any of columns named in ... are missing, they are added to the dataframe.

Examples

1
2
3
4
5
6
7
## Not run: 
add_col_if_missing(
  iris,
  Species = "col exists. this shouldn't do anything",
  Species2 = "col doesn't exist. this should be added")

## End(Not run)

HomeBankCode/DarcleITS documentation built on April 14, 2020, 9:48 a.m.