Skip to contents

Warn and replace existing variables in a data frame

Usage

warn_replace(df, vars)

Arguments

df

The data frame to check for existing variables

vars

A character vector of variable names to check for

Details

This function checks if any of the variables in vars are already present in df. If any are found, a warning is issued and the variables are replaced from df.

Examples

df <- data.frame(x = 1, y = 2)
warn_replace(df, c("x", "z"))
#> Error in warn_replace(df, c("x", "z")): could not find function "warn_replace"