Vector-class-leftovers {IRanges} | R Documentation

## Vector objects (old man page)

### Description

IMPORTANT NOTE - 4/29/2014: This man page is being refactored. Most of the things that used to be documented here have been moved to the man page for Vector objects located in the S4Vectors package.

### Evaluation

In the following code snippets, `x` is a Vector object.

  `with(x, expr)`: Evaluates `expr` within `as.env(x)` via `eval(x)`.

  `eval(expr, envir, enclos=parent.frame())`: Evaluates `expr` within `envir`, where `envir` is coerced to an environment with `as.env(envir, enclos)`. The `expr` is first processed with `bquote`, such that any escaped symbols are directly resolved in the calling frame.

### Convenience wrappers for common subsetting operations

In the code snippets below, `x` is a Vector object or regular R vector object. The R vector object methods for `window` are defined in this package and the remaining methods are defined in base R.

  `window(x, start=NA, end=NA, width=NA) <- value`: Replace the subsequence window specified on the left (i.e. the subsequence in `x` specified by `start`, `end` and `width`) by `value`. `value` must either be of class `class(x)`, belong to a subclass of `class(x)`, or be coercible to `class(x)` or a subclass of `class(x)`. The elements of `value` are repeated to create a Vector with the same number of elements as the width of the subsequence window it is replacing.

  `rev(x)`: Return a new Vector object made of the original elements in the reverse order.

  `rep(x, times, length.out, each)`, `rep.int(x, times)`: Repeats the values in `x` through one of the following conventions:

  `times`

    Vector giving the number of times to repeat each element if of length `length(x)`, or to repeat the whole vector if of length 1.

  `length.out`

    Non-negative integer. The desired length of the output vector.

  `each`

    Non-negative integer. Each element of `x` is repeated `each` times.

### Combining

In the code snippets below, `x` is a Vector object.

  `mstack(..., .index.var = "name")`: A variant of `stack`, where the list is taken as the list of arguments in `...`, each of which should be a `Vector` or `vector` (mixing the two will not work).

### Looping

In the code snippets below, `x` is a Vector object.

  `tapply(X, INDEX, FUN = NULL, ..., simplify = TRUE)`: Like the standard `tapply` function defined in the base package, the `tapply` method for Vector objects applies a function to each cell of a ragged array, that is to each (non-empty) group of values given by a unique combination of the levels of certain factors.

### Coercion

  `as.list(x)`: coerce a Vector to a list, where the `i`th element of the result corresponds to `x[i]`.

### See Also

The Vector class defined and documented in the S4Vectors package.

[Package IRanges version 2.14.12 Index]