decile: Create deciles of a variable

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/decile.R

Description

Takes in a vector, and returns the deciles

Usage

1
decile(vector, decreasing = FALSE)

Arguments

vector

an integer or numeric vector

decreasing

a logical input, which if set to FALSE puts smallest values in decile 1 and if set to TRUE puts smallest values in decile 10; FALSE is default

Details

decile is a convinient function to get integer deciles of an integer or numeric vector. By default, the smallest values are placed in the smallest decile.

Sometimes one may want to put smallest values in the biggest decile, and for that the user can set the decreasing argument to TRUE; by default it is FALSE.

Value

an integer vector of decile values

Author(s)

Akash Jain

See Also

pentile, outliers, imputemiss

Examples

1
2
3
4
5
6
7
# Scores vector
scores <- c(1, 4, 7, 10, 15, 21, 25, 27, 32, 35,
            49, 60, 75, 23, 45, 86, 26, 38, 34, 67)

# Create deciles based on the values of the vector
decileScores <- decile(vector = scores)
decileScores <- decile(vector = scores, decreasing = TRUE)

Example output



StatMeasures documentation built on May 2, 2019, 1:44 p.m.