rerange {PROscorerTools}R Documentation

Change the range of an item or score

Description

Usage

rerange(score, old = NULL, new = c(0, 100), rev = FALSE)

rerange100(score, mn, mx)

Arguments

score

The variable to be re-ranged.

old

A numeric vector of length 2 indicating the old range (e.g., c(min, max) score. This is a required argument.

new

A numeric vector of length 2 indicating the new range you want for score. The default value is c(0, 100).

rev

Logical, if TRUE score will will not only be re-ranged, but it will also be reversed (see Details for more information). The default is FALSE.

mn

The minimum possible value that score can take.

mx

The maximum possible value that score can take.

Details

The rerange function can re-range and reverse code a variable all at once. If rev = TRUE, score will be reversed using revcode after it is re-ranged. The same could be accomplished by keeping rev = FALSE and reversing the order of the range given to new. For example, the following two calls to rerange will return the same values:

The rerange100 function is a short-cut for rerange with the arguments set to the values typically used when scoring a PRO measure. Specifically, rerange100 is defined as:

These functions can produce verbose warning messages. If you are using this function within another function, you can suppress these messages by wrapping your call to rerange in suppressWarnings().

Value

A re-ranged vector.

A version of score that is rescaled to range from 0 to 100.

Examples

qol_score <- c(0:4)

# Default is to rerange to c(0, 100)
rerange(qol_score, old = c(0, 4))
# Below gives same result as above
rerange100(qol_score, 0, 4)

# These two lines are different ways to rerange and reverse code at same time
rerange(qol_score, old = c(0, 4), new = c(0, 100), rev = TRUE)
rerange(qol_score, old = c(0, 4), new = c(100, 0))

[Package PROscorerTools version 0.0.4 Index]