replace_code: Replace particular code(s)

Description Usage Arguments Examples

View source: R/RecodeR.R

Description

This function is to replace code(s) in either SA or MA question

Usage

1
replace_code(vector, to_be_replaced, replacement)

Arguments

vector

character vector (MA question) or single numeric value (SA question)

to_be_replaced

character string (only 1 code to be replaced) or character vector (more than 1 code to be replaced)

replacement

character string (only 1 code as replacement) or character vector (more than 1 code as replacement)

Examples

1
2
replace_code(c("1", "2,4", "3,5"), 1, 2)#"2"   "2,4" "3,5"
replace_code(c(1, 2, 3), 1, 99)#99  2  3

momo3246/recode documentation built on Sept. 30, 2020, 2:14 p.m.