billionaiRe_add_columns: Add columns to data frame if not already existing

View source: R/utils_columns.R

billionaiRe_add_columnsR Documentation

Add columns to data frame if not already existing

Description

The function takes in a data frame, a vector of column names, and a vector of base fill to use for the column. If the column doesn't already exist, it is added to the data frame and filled with the relevant fill value.

Usage

billionaiRe_add_columns(df, cols, fill)

Arguments

df

A data frame.

cols

A character vector of column names to add.

fill

A list of fill to be used for each column. If length 1, same fill is used for each column. Can also be a vector, but lists allow different types of fill, e.g. fill = list(NA_character_, NA_real_).

Value

A data frame.


gpw13/billionaiRe documentation built on Sept. 27, 2024, 10:05 p.m.