generate_recodes: Convenience functions for interval recodes

Description Usage Arguments Value Examples

View source: R/recode_helpers.R

Description

Get recode assigments for even intervals of discrete numeric values compatible with car::recode.

Usage

1
generate_recodes(from, to, width = 5)

Arguments

from, to

A numeric value for the beginning and the end of the interval.

width

The width of the interval, e.g. 5 (default) for intervals 0-5.

Value

A character vector of recode assignments compatible with car::recode.

Examples

1
2
3
4
5
6
7
8
## Not run: 
x <- round(runif(100, 0, 100), 0)
recodes <- generate_recodes(0, 100, 10)

library(car)
recode(x, recodes = recodes)

## End(Not run)

tadaatoolbox documentation built on July 2, 2020, 2:30 a.m.