swap_by_ids: Renames values within a dataframe based on ids. Useful for...

Description Usage Arguments

View source: R/swap_by_ids.R

Description

Renames values within a dataframe based on ids. Useful for imputation.

Usage

1
swap_by_ids(df, variable, swap_list, idname = "id")

Arguments

df

data frame. The data to be transformed.

variable

character. The name of the variable in df where the replacement occurs.

swap_list

list. A list mapping ids to the desired value for that id. e.g., to replace the value for id #233 with "cat", use list('233' = 'cat')

idname

character. The name of the column with ids.


peterhurford/surveytools2 documentation built on Feb. 18, 2021, 9:13 p.m.