baytrends (version 1.1.0)

sort.lcens: 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 lcens
sort(x, decreasing = FALSE, na.last = NA, ...)

# S3 method for 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

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

# }

Run the code above in your browser using DataCamp Workspace