xtfrm {base}R Documentation

Auxiliary Function for Sorting and Ranking

Description

A generic auxiliary function that produces a numeric vector which will sort in the same order as x.

Usage

xtfrm(x)

Arguments

x an R object.

Details

This is a special case of ranking, but as a less general function than rank is more suitable to be made generic. The default method is equivalent to rank(x, ties.method="min", na.last="keep"), so NA values are given rank NA and all tied values are given equal integer rank.

The factor method extracts the codes. The Surv method sorts first on times and then on status code(s).

The default method will make use of == and > methods for the class of x[i] (for integers i), and the is.na method for the class of x, but might be rather slow when doing so.

Value

A numeric (usually integer) vector of the same length as x.

See Also

rank, sort, order.


[Package base version 2.9.1 Index]