Rev 68017 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/xtfrm.Rd% Part of the R package, https://www.R-project.org% Copyright 2008-2015 R Core Team% Distributed under GPL 2 or later\name{xtfrm}\alias{xtfrm}\alias{xtfrm.default}\alias{xtfrm.factor}\alias{xtfrm.AsIs}\alias{xtfrm.Surv}\alias{xtfrm.Date}\alias{xtfrm.POSIXct}\alias{xtfrm.POSIXlt}\alias{xtfrm.difftime}\title{Auxiliary Function for Sorting and Ranking}\description{A generic auxiliary function that produces a numeric vector whichwill sort in the same order as \code{x}.}\usage{xtfrm(x)}\arguments{\item{x}{an \R object.}}\details{This is a special case of ranking, but as a less general function than\code{\link{rank}} is more suitable to be made generic. The defaultmethod is similar to \code{rank(x, ties.method = "min",na.last = "keep")}, so \code{NA} values are given rank \code{NA} and alltied values are given equal integer rank.The \code{\link{factor}} method extracts the codes. The\code{\link[survival]{Surv}} method sorts first on times and then onstatus code(s), finally on \code{timme2} if present. Note that withthe conventional status codes this sorts individuals still alive beforedeaths.The default method will unclass the object if\code{\link{is.numeric}(x)} is true but otherwise make use of\code{==} and \code{>} methods for the class of \code{x[i]} (forintegers \code{i}), and the \code{is.na} method for the class of\code{x}, but might be rather slow when doing so.This is an \link{internal generic} \link{primitive}, so S3 or S4methods can be written for it.}\value{A numeric (usually integer) vector of the same length as \code{x}.}\seealso{\code{\link{rank}}, \code{\link{sort}}, \code{\link{order}}.}\keyword{univar}\keyword{manip}