File: base-rank.Rd

package info (click to toggle)
r-cran-timeseries 4041.111-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,704 kB
  • sloc: makefile: 14
file content (73 lines) | stat: -rw-r--r-- 1,895 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
\name{rank}
\alias{rank}

\alias{rank,timeSeries-method}


\title{Sample ranks of a time series}

\description{
    
  Compute the sample ranks of the values of a 'timeSeries' object.
      
}

\usage{
\S4method{rank}{timeSeries}(x, na.last = TRUE, ties.method = )
}

\arguments{
        
  \item{x}{
    an univariate object of class \code{timeSeries}.
  }
  \item{na.last}{

    for controlling the treatment of \code{NA}s. If \code{TRUE}, missing
    values in the data are put last; if \code{FALSE}, they are put
    first; if \code{NA}, they are removed; if \code{"keep"} they are
    kept with rank \code{NA}.

  }
  \item{ties.method}{

    a character string specifying how ties are treated; can be
    abbreviated.

  }  
}

\details{

  If all components are different (and no \code{NA}s), the ranks are
  well defined, with values in \code{seq_len(x)}. With some values equal
  (called \sQuote{ties}), argument \code{ties.method} determines the
  result at the corresponding indices. The \code{"first"} method results
  a permutation with increasing values at each index set of ties. The
  \code{"random"} method puts these in random order, whereas the
  default, \code{"average"}, replaces them by their mean, and
  \code{"max"} and \code{"min"} replace them with their maximum and
  minimum respectively, the latter being the typical sports ranking.

  \code{NA} values are never considered to be equal: for \code{na.last =
  TRUE} and \code{na.last = FALSE} they are given distinct ranks in the
  order in which they occur in \code{x}.

}

\value{
  a \code{"timeSeries"} object
}

\examples{
## Load Microsoft Data -
   X <- 100 * returns(MSFT)

## Compute the Ranks -
   head(rank(X[, "Open"]), 10)
   
## Only Interested in the Vector, then use -
   head(rank(series(X[, "Open"])), 10)
}

\keyword{chron}