recode2Integer: Recode a vector of real values to integers matching a given...

View source: R/buildRandomImage4PCA.R

recode2IntegerR Documentation

Recode a vector of real values to integers matching a given distribution for the integers

Description

recode2Integer: Recodes a vector of real values to integers matching a given distribution for the integers

Usage

recode2Integer(original.var, toBeScaled.var)

Arguments

original.var

A vector of integers (e.g., Likert scale), used to derive the distribution of the integers.

toBeScaled.var

a vector of real values to be recoded as integers (with the same distribution as original.var).

Details

recode2Integer: can be used to transform a vector or real numbers to a vector of integers such as, for example, the score obtained from a Likert scale. Note that the more elements the original vector has, the better the quality of the transformation, because ties can create problem wih small samples.

Value

A vector of integers matching the distribution of the integers in original.var.

Author(s)

Hervé Abdi

Examples

set.seed(42)
toto <- rnorm(1:10)
toto.scaled <- recode2Integer(c(1,1,1,3,4,4,1,2,2,4), toto)

HerveAbdi/data4PCCAR documentation built on Sept. 11, 2022, 4:19 p.m.