scaleData: Scale Function

Description Usage Arguments Value See Also Examples

View source: R/RegressionLibs.R

Description

Function to scale the data set. If you use normalize function first and then scaleData function you could obtain a normalize dataset in a range [x,y]

Usage

1
scaleData(dataSet, min, max)

Arguments

dataSet

an object of class data frame with the original data set.

min

an integer with the min value that you want scale the data set.

max

an integer with the max value that you want scale the data set.

Value

an object of class data frame with a modified data set scaled in the defined range.

See Also

normalize, normalizeData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#Example 1
iris.x <- iris[,1:4] #Just numerical columns witout missing values

normed <- as.data.frame(lapply(iris.x, normalize))
normedIris <- as.data.frame(lapply(normed, scaleData, 1, 10)) #In range [1,10]


#Example 2
# Getting a data set without missing values
cars <- read.csv("https://dl.dropboxusercontent.com/u/12599702/autosclean.csv", sep = ";", dec = ",")

normed <- as.data.frame(lapply(cars, normalize))
normedCars <- as.data.frame(lapply(normed, scaleData, 1, 10)) #In range [1,10]

mariytu/RegressionLibs documentation built on May 21, 2019, 11:47 a.m.