selective_multi_replace: Replace NA and 0 values in a data frame column with 1 if...

View source: R/clean_timci_data.R

selective_multi_replaceR Documentation

Replace NA and 0 values in a data frame column with 1 if another corresponding column is 1.

Description

This function replaces NA and 0 values in a specified column of a data frame with 1 if another corresponding column with the same name and a "1" suffix has a value of 1.

Usage

selective_multi_replace(df, col, cols)

Arguments

df

A data frame.

col

A character string indicating the name of the column to replace.

cols

A character vector of column names to check for the existence of the 'col' column.

Value

The input data frame with specified column values replaced.


Thaliehln/timci documentation built on April 8, 2024, 3:38 p.m.