Skip to contents

Recode and convert a single column based on the mapping

Usage

recode_and_convert_column(df, col_name, mapping)

Arguments

df

A data frame containing the column to be recoded

col_name

Character, name of the column to recode

mapping

A list containing the old and new levels for the column

Value

The data frame with the specified column recoded and converted to factor