recode: recode

View source: R/recode.R

recodeR Documentation

recode

Description

Recodes values in a vector based on original and new values provided as two vectors.

Usage

recode(x, oldvalue, newvalue)

Arguments

x

A vector with values to be replaced.

oldvalue

A vector of original values to be recoded.

newvalue

A vector of replacement values of the same length as oldvalue.

Value

A vector of same length as input.

Author(s)

Nick Bond <n.bond@latrobe.edu.au>

Examples

x<-seq(1:10)
recode(x, c(1,5,10), c(-1,-5,-10))

hydrostats documentation built on June 1, 2022, 9:06 a.m.