calculate_coalesce_origin: Calculate originating column for a coalesce operation

calculate_coalesce_originR Documentation

Calculate originating column for a coalesce operation

Description

calculate_coalesce_origin will determine the column from which a value was filled during a coalesce procedure. Ensure that all blanks or other undesired patterns are converted to NA before starting. Provide columns in order coalesce is expected to occur.

Usage

calculate_coalesce_origin(data, cols)

Arguments

data

Originating dataset that coalesce procedure occurred on.

cols

Character vector of column names, in order coalesce would occur.

Value

Character vector with names of originating columns.

Examples

testdata <- data.frame(col1 = c(1,2,3), col2 = c(NA, NA, 3), col3 = c(1, NA, 4))
calculate_coalesce_origin(testdata, c('col2', 'col3'))

al-obrien/farrago documentation built on April 14, 2023, 6:20 p.m.