R/quantiles.R

Defines functions q75 q25

Documented in q25 q75

#' Return the 25th percentile.
#' 
#' @param x numeric vector.
#' @param na.rm	logical; if true, any NA and NaN's are removed from x before the
#'        quantiles are computed
#' @param ... other parameters passed to \code{\link{quantile}}.
#' @export
#' @return the 25th percentile.
q25 <- function(x, na.rm = FALSE, ...) {
	return(unname(quantile(x, na.rm=na.rm, ...)[2]))
}

#' Returns the 75th percentile.
#' 
#' @param x numeric vector.
#' @param na.rm	logical; if true, any NA and NaN's are removed from x before the
#'        quantiles are computed
#' @param ... other parameters passed to \code{\link{quantile}}.
#' @export
#' @return the 75th percentile.
q75 <- function(x, na.rm = FALSE, ...) {
	return(unname(quantile(x, na.rm=na.rm, ...)[4]))
}

Try the PSAboot package in your browser

Any scripts or data that you put into this service are public.

PSAboot documentation built on Oct. 24, 2023, 1:06 a.m.