rank | R Documentation |

Compute the sample ranks of the values of a 'timeSeries' object.

```
## S4 method for signature 'timeSeries'
rank(x, na.last = TRUE, ties.method = )
```

`x` |
an univariate object of class |

`na.last` |
for controlling the treatment of |

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

If all components are different (and no `NA`

s), the ranks are
well defined, with values in `seq_len(x)`

. With some values equal
(called ‘ties’), argument `ties.method`

determines the
result at the corresponding indices. The `"first"`

method results
a permutation with increasing values at each index set of ties. The
`"random"`

method puts these in random order, whereas the
default, `"average"`

, replaces them by their mean, and
`"max"`

and `"min"`

replace them with their maximum and
minimum respectively, the latter being the typical sports ranking.

`NA`

values are never considered to be equal: for ```
na.last =
TRUE
```

and `na.last = FALSE`

they are given distinct ranks in the
order in which they occur in `x`

.

a `"timeSeries"`

object

```
## 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)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.