Description Usage Arguments Value Examples
View source: R/extract-helpers.R
Add default-value columns to a dataframe
1 |
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. |
the dataframe is returned. If any of columns named in ...
are
missing, they are added to the dataframe.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.