Learn R Programming

rindex (version 0.12.1)

sort.index: Index extraction

Description

Functions to extract from an index 1) the original vecor, 2) the sorted vector, 3) the original positions (order) and 4) logical NAiness.

Usage

# S3 method for index
[(x, i, ...)
  # S3 method for index
sort(x, decreasing = FALSE, na.last = NA, ...)
  order.index(..., na.last = TRUE, decreasing = FALSE)
  # S3 method for index
is.na(x)

Arguments

x

an object of class ‘index’

i

subset information

one object of class ‘index’ for order.index, otherwise not to be used

decreasing

TRUE to sort decreasing (default FALSE)

na.last

FALSE to sort NAs first (default TRUE)

Value

Function [.index returns the original vector (or part of it), sort.index returns a sorted vector of values, order.index returns a vector of original integer positions and is.na.index returns a logical vector.

Details

sort.index identical to sort of original vector, but much faster
order.index identical to order of original vector, but much faster
[.index index[] returns original vector, subsetting works identical to susetting original vector [ (via NextMethod)
[<-.index currently forbidden
is.na.index identical to is.na of original vector, but much faster

See Also

index, sort, order, [