View source: R/add_missing_column.R
add_missing_column | R Documentation |
add_missing_column()
adds one or more columns to an existing data frame only if they
do not already exist.
This is a simple wrapper around add_column()
.
add_missing_column(
.data,
...,
.before = NULL,
.after = NULL,
.name_repair = c("check_unique", "unique", "universal", "minimal")
)
.data |
Data frame to append to. |
... |
< |
.before , .after |
One-based column index or column name where to add the new columns, default: after last column. |
.name_repair |
Treatment of problematic column names:
This argument is passed on as |
add_column()
# add new columns x and y
add_missing_column(mtcars, x = 1, y = NA)
# add new columns from a named vector
new_cols <- c(x = 1, y = NA)
add_missing_column(mtcars, !!!new_cols)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.