Learn R Programming

analyzer (version 1.0.1)

skewness: Skewness

Description

skewness calculates the skewness

Usage

skewness(x, na.rm = T)

Arguments

x

a numeric vector, matrix or a data.frame

na.rm

(logical) Should missing values be removed?

Value

returns a single value if x is a vector, otherwise a named vector of size = ncol(x).

Details

This function calculates the skewness of data which is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. The formula used is: $$\frac{E[(X-\mu)^{3}]}{(E[(X-\mu)^2])^\frac{3}{2}}$$. This formula is the typical definition used in many older textbooks and wikipedia

Examples

Run this code
# NOT RUN {
# for a single vector
skewness(mtcars$mpg)

# for a dataframe
skewness(mtcars)

# }

Run the code above in your browser using DataLab