toLik {multiUS}R Documentation

Transform continous variable to a Likert-type variable

Description

The function transforms a continous variable to a k-point Likert-type variable. Different styles of answering to a survey are possible.

Usage

toLik(x, type = "eq", q = 1.5, k = 5, r = range(x), num = TRUE)

Arguments

x

Vector with values to be transformed.

type

Type of transformation. Possible values are: eq (default) (equal wide intervals), yes (wider intervals at higher values of x), no (wider intervals at lower values of x), avg (wider intervals near the mean of x).

q

Extension factor. Tells how much is each next interval wider then the previous one. Not used when type="eq".

k

Number of classes.

r

Minimum and maximum values to define intervals of x. Default are minimum and maximum values of x.

num

If TRUE (default) numberical values are returned, otherwise intervals are returned.

Value

Transformed values are organized into a vector.

Author(s)

Aleš Žiberna

Examples

x <- rnorm(1000)
hist(x = toLik(x, type = "eq"), breaks = 0:5+0.5, xlab = "answer", main = "type = 'eq'")
hist(x = toLik(x, type = "yes"), breaks = 0:5+0.5, xlab = "answer", main = "type = 'yes'")
hist(x = toLik(x, type = "no"), breaks = 0:5+0.5, xlab = "answer", main = "type = 'no'")
hist(x = toLik(x, type = "avg"), breaks = 0:5+0.5, xlab = "answer", main = "type = 'avg'")

[Package multiUS version 1.0.5 Index]