xtfrm

0th

Percentile

Auxiliary Function for Sorting and Ranking

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

Keywords
manip, univar
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 similar 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 default method will unclass the object if is.numeric(x) is true but otherwise 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.

This is an internal generic primitive, so S3 or S4 methods can be written for it.

Value

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

See Also

rank, sort, order.

Aliases
  • xtfrm
  • xtfrm.default
  • xtfrm.factor
  • xtfrm.AsIs
  • xtfrm.Date
  • xtfrm.POSIXct
  • xtfrm.POSIXlt
  • xtfrm.difftime
Documentation reproduced from package base, version 3.6.0, License: Part of R 3.6.0

Community examples

Looks like there are no examples yet.