Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pentile

Create pentiles of a variable


Description

Takes in a vector, and returns a vector of pentiles

Usage

pentile(vector, decreasing = FALSE)

Arguments

vector

an integer or numeric vector

decreasing

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

Details

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

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

Value

an integer vector of pentile values

Author(s)

Akash Jain

See Also

Examples

# 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 pentiles based on the values of the vector
pentileScores <- pentile(vector = scores)
pentileScores <- pentile(vector = scores, decreasing = TRUE)

StatMeasures

Easy Data Manipulation, Data Quality and Statistical Checks

v1.0
GPL-2
Authors
Akash Jain
Initial release
2015-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.