add_missing_columns: Add Missing Columns

Description Usage Arguments Value Author(s) Examples

View source: R/add_missing_columns.R

Description

Appends to the dataframe x the columns not present in colnames. Then, it fills them with filler.

Usage

1

Arguments

x

A dataframe with names.

colnames

A vector of characters corresponding to the column names to be added to x if they are not already present.

filler

A number or string to fill the new columns with, e.g., -999.99.

Value

The dataframe x with extra columns.

Author(s)

Guillermo Basulto-Elias

Examples

1
2
3
4
library(rmiscfun)
input_df <- data.frame(a = 1:3, b = letters[1:3])
colnames_vector <- c("a", "b", "c")
add_missing_columns(input_df, colnames_vector, -888)

gbasulto/rmiscfun documentation built on July 25, 2019, 8:56 p.m.