make.pctile.cols: Make columns of (weighted) percentiles from columns of values

View source: R/make.pctile.cols.R

make.pctile.colsR Documentation

Make columns of (weighted) percentiles from columns of values

Description

Takes values (vector, matrix, or data.frame) and returns percentiles, showing the percentile of a value within all values in its column.

Usage

make.pctile.cols(
  values,
  weights = 1,
  prefix = "pctile.",
  as.df = TRUE,
  zone = NULL
)

Arguments

values

Data.frame, matrix, or vector of values. One column at a time is analyzed using assign.pctiles()

weights

Optional numeric vector of weights (default is unweighted) to create weighted percentiles, such as population-weighted quantiles. Unweighted if not specified. Vector same length as number of rows in values parameter (or elements if vector).

prefix

Optional character element, default is 'pctile.', provides text to paste to beginning of input data.frame column names to use as output column names.

as.df

Optional logical TRUE by default, in which case matrix results are converted to data.frame

zone

NULL by default, but if a vector is provided, it defines zones to group by, so percentiles are within a given zone only.

Value

Returns a matrix or data.frame

See Also

make.bin.pctile.cols() and assign.pctiles()


ejanalysis/ejanalysis documentation built on April 2, 2024, 10:12 a.m.