sort.censored: Sorting Vectors

sort.lcensR Documentation

Sorting Vectors

Description

Sorts a vector into ascending or descending order: methods for "lcens" and "mcens" data. This function sorts left-censored values immediately below the equivalent uncensored values and right-censored values immediately above the equivalent uncensored values.

Usage

## S3 method for class 'lcens'
sort(x, decreasing = FALSE, na.last = NA, ...)

## S3 method for class 'mcens'
sort(x, decreasing = FALSE, na.last = TRUE, ...)

Arguments

x

the data to be sorted.

decreasing

sort the data in descending order?

na.last

for controlling the treatment of NAs. If TRUE, then missing values in the data are put last; if FALSE, then they are put first; if NA, then they are removed.

...

arguments to be passed to or from methods.

Value

An object like x, but with the data sorted. Left-censored values are placed between smaller numeric values and the corresponding uncensored values.

Examples

set.seed(5422)
XR <- rnorm(10)
sort(as.lcens(XR, rep(c(0, -1), each=5))) # censors at 0 and -1


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