resc.val: R function to rescale the values of a datset between a...

Description Usage Arguments Details Examples

Description

The function allows to rescale the values of a dataset between a minimum and a maximum that are specified by the user. In doing that, it allows to preserve the shape of the distribution of the original data.

Usage

1
resc.val(x, min.v = 0, max.v = 100)

Arguments

x:

vector containing the values to be rescaled.

min.v:

the minimum value of the rescaled dataset (0 by default).

max.v:

the maximum value of the rescaled dataset (100 by default).

Details

The function produces two density charts representing the distribution of the original and of the rescaled dataset. It also returns a dataframe storing the original and rescaled values.

Examples

1
2
dataset <- rnorm(30, 1000,10) #generate a random dataset of size 30, normally distributed with mean 1000 and standard deviation 10
resc.val(dataset, min.v=10, max.v=100) #rescale the dataset to be constrained between 10 and 100

gianmarcoalberti/GmAMisc documentation built on May 3, 2019, 6:44 p.m.