Learn R Programming

gendata (version 1.2.0)

recalib: Recalibrate (rescale) Variables

Description

Rescale variables (one at a time) to have a new minimum and maximum value.

Usage

recalib(data, var, low, high)

Arguments

data

the dataset to use.

var

indicate the variable number (or variable name).

low

Indicate the new minimum value.

high

Indicate the new maximum value.

Details

Specify the rescaling of variables one at a time.

See Also

genmvnorm revcode dtrans

Examples

Run this code
# NOT RUN {
sdata <- genmvnorm(cor = c(.7, .2, .3), k = 3, n = 500, seed = 12345)
cor(sdata)
summary(sdata[,1])
#note the min and max of variable X1
#changes variable one to have a minimum of 10 and a maximum of 50
#correlations remain the same

s2 <- recalib(sdata, 1, 10, 50)
cor(s2)
summary(s2[,1])
#note revised values of variable X1

# }

Run the code above in your browser using DataLab