percentile: Empirical Cumulative Percent

View source: R/percentile.R

percentileR Documentation

Empirical Cumulative Percent

Description

Computes the empirical cumulative percent or percent exceedance of observed data for specific values.

Usage

percentile(x, q, test = ">=", na.rm = TRUE, percent = TRUE, ...)

## Default S3 method:
percentile(x, q, test = ">=", na.rm = TRUE,
  percent = TRUE, ...)

Arguments

x

a numeric vector representing the observed data.

q

a vector of quantiles for which the cumulative percent or percent exceedence is desired.

test

a character string indicating the test. The default value, '>=,' is the percent equalling or exceeding the quantile and '<' would return the cumulative percent below the quantile.

na.rm

a logical value indication whether missing values (NAs) should be removed or not. If na.rm is FALSE and there are missing values in x, then the result will be NA. The default value is TRUE.

percent

a logical value indicating whether the result should be expressed as a percent or proportion. The default value, TRUE, will express the result as a percent.

...

not used, required for method function

Value

A named vector as long as q corresponding to the requested value.

Note

The stats package contains the ecdf function that performs a similar function when test is "<=."

See Also

ecdf

Examples

set.seed(2342)
Xr <- rlnorm(24)
# The percentage of the observarions greater than or equal to 2
percentile(Xr, 1:5)

USGS-R/smwrStats documentation built on Oct. 11, 2022, 6:15 a.m.