R Tutorial R Charts & Graphs R Statistics R References

R Statistical Functions



R has a rich set of built-in functions for performing statistical operations such as calculating mean, variance, standard deviation, and probability functions. These functions are listed below. For more details about any one of these, please visit its page.

R Statistical Functions

FunctionsDescription
mean() Computes arithmetic mean of the sample.
median() Computes median of the sample.
sum() Returns sum of all elements present in the argument.
max() Returns largest of all elements present in the argument.
min() Returns smallest of all elements present in the argument.
sd() Returns standard deviation of all elements present in the argument.
var() Returns variance of all elements present in the argument.
range() Returns a vector containing the minimum and maximum of all the given arguments.
quantile() Returns sample quantiles corresponding to the given probabilities.
diff() Returns suitably lagged and iterated differences.
scale() Returns the centered, scaled matrix.
sort() Returns a vector sorted into ascending or descending order.

R Statistical Probability Functions

DistributionsFunctionsDescription
Normal Distribution dnorm()Measures probability density function (pdf) of the distribution.
pnorm()Returns cumulative distribution function (cdf) of the distribution.
qnorm()Returns cumulative value corresponding to probability value of the distribution.
rnorm()Generates a vector containing specified number of random values from the distribution.
Binomial Distribution dbinom()Measures probability mass function (pmf) of the distribution.
pbinom()Returns cumulative distribution function (cdf) of the distribution.
qbinom()Returns cumulative value corresponding to probability value of the distribution.
rbinom()Generates a vector containing specified number of random values from the distribution.
Geometric Distribution dgeom()Measures probability mass function (pmf) of the distribution.
pgeom()Returns cumulative distribution function (cdf) of the distribution.
qgeom()Returns cumulative value corresponding to probability value of the distribution.
rgeom()Generates a vector containing specified number of random values from the distribution.
Logistic Distribution dlogis()Measures probability density function (pdf) of the distribution.
plogis()Returns cumulative distribution function (cdf) of the distribution.
qlogis()Returns cumulative value corresponding to probability value of the distribution.
rlogis()Generates a vector containing specified number of random values from the distribution.
Exponential Distribution dexp()Measures probability density function (pdf) of the distribution.
pexp()Returns cumulative distribution function (cdf) of the distribution.
qexp()Returns cumulative value corresponding to probability value of the distribution.
rexp()Generates a vector containing specified number of random values from the distribution.
Uniform Distribution dunif()Measures probability density function (pdf) of the distribution.
punif()Returns cumulative distribution function (cdf) of the distribution.
qunif()Returns cumulative value corresponding to probability value of the distribution.
runif()Generates a vector containing specified number of random values from the distribution.
Poisson Distribution dpois()Measures probability mass function (pmf) of the distribution.
ppois()Returns cumulative distribution function (cdf) of the distribution.
qpois()Returns cumulative value corresponding to probability value of the distribution.
rpois()Generates a vector containing specified number of random values from the distribution.
Weibull Distribution dweibull()Measures probability density function (pdf) of the distribution.
pweibull()Returns cumulative distribution function (cdf) of the distribution.
qweibull()Returns cumulative value corresponding to probability value of the distribution.
rweibull()Generates a vector containing specified number of random values from the distribution.