R: Recode

recode {blockmodeling} | R Documentation

## Recode

### Description

Recodes values in a vector.

### Usage

    recode(x, oldcode = sort(unique(x)), newcode)

### Arguments

`x` | A vector.
`oldcode` | A vector of old codes.
`newcode` | A vector of new codes.

### Value

A recoded vector.

### Author(s)

Aleš Žiberna

### Examples

    x <- rep(1:3, times = 1:3)
    newx <- recode(x, oldcode = 1:3, newcode = c("a", "b", "c"))

[Package blockmodeling version 1.0.0 Index]