standardise_variables: Standardise the Numeric Variables of a given Dataset

Description Usage Arguments Value See Also Examples

Description

This function standardises numeric variables of a given data. There are three methods; range standardisation, normalisation standardisation, and median absolute deviation standardisation. Range standardisation standardises the numeric variables to a specified range, the default is [0, 1]. Normalisation standardisation standardises the numeric variables to have mean 0 and standard deviation 1. Median Absolute Devation standardisation standardises the numeric variables to have median 0 and median absolute deviation 1.

Usage

1
2
standardise_variables(dataset, method = c("range", "norm", "MAD"),
  lower_bound = 0, upper_bound = 1, file_name = NULL, directory = NULL)

Arguments

dataset

A dataset to be standardised, the dataset can have mixed types.

method

A charactor object denoting the method of standardisation used. One of three possible options; "range", "norm", "MAD".

lower_bound

The lower bound of the range standardisation, default is 0.

upper_bound

The upper bound of the range standardisation, default is 1.

file_name

A character object indicating the file name when saving the data frame. The default is NULL. The name must include the .csv suffixs.

directory

A character object specifying the directory where the data frame is to be saved as a .csv file.

Value

Outputs the standardised dataset as data frame.

See Also

remove_variables, derive_variables, extract_variables, impute_variables, transform_variables

Examples

1
2
3
4
5
6
7
8
9
# Example Data
x1 <- rnorm(n = 60, mean = 50, sd = 10)
x2 <- rpois(n = 60, lambda = 50)
x3 <- sample(x = 1:10, size = 60, replace = TRUE)
# Standardise the Numeric Variables
standardise_x(dataset = x1, method = "range")
standardise_x(dataset = iris, method = "range", lower_bound = 10, upper_bound = 100)
standardise_x(dataset = x2, method = "norm")
standardise_x(dataset = x3, method = "MAD")

oislen/BuenaVista documentation built on May 16, 2019, 8:12 p.m.