recodeDFas: Recode variables in dataframe to match codes in another...

Description Usage Arguments Details Value Author(s)

View source: R/merge_utils.R

Description

Recode variables in dataframe to match codes in another dataframe

Usage

1
recodeDFas(df1, df2, cols1, cols2 = cols1)

Arguments

df1

dataframe to be recoded

df2

dataframe to copy codes from

cols1

numeric/character vector indicating variables of first dataframe to be recoded

cols2

numeric/character vector indicating variables of second dataframe to copy codes from

Details

This is a wrapper around recodeAs. Each variable of 'df1' listed in 'cols1' will be recoded to the corresponding variable of 'df2' listed in 'cols2'. If length(cols2) < length(cols1) then the final variable in 'cols2' will be used for all excess variables in 'cols1'. If 'cols2' is not supplied then it will take the same value as 'cols1'.

Value

a dataframe (recoded version of 'df1')

Author(s)

Ben Veal


vapniks/mergeutils documentation built on May 3, 2019, 4:33 p.m.