rep_vt-class {matter} | R Documentation

## Virtual Replication of Vectors

### Description

The `rep_vt` class simulates the behavior of the base function `rep` without actually allocating memory for the duplication. Only the original vector and the expected length of the result are stored. All attributes of the original vector (including names) are dropped.

### Usage

    ## Instance creation
    rep_vt(x, times, length.out = length(x) * times)

    ## Additional methods documented below

### Arguments

`x` | A vector (of any mode).
`times` | The number of times to repeat the whole vector.
`length.out` | The desired length of the result.

### Value

An object of class `rep_vt`.

### Slots

`data`:

  The original vector.

`length`:

  The expected length of the repeated virtual vector.

### Creating Objects

`rep_vt` instances can be created through `rep_vt()`.

### Methods

Standard generic methods:

`x[i]`:

  Get the elements of the uncompressed vector.

`x[[i]]`:

  Get a single element of the uncompressed vector.

`length(x)`:

  Get the length of the uncompressed vector.

### Author(s)

Kylie A. Bemis

### See Also

`[base]{rep}`

### Examples

    ## Create a rep_vt vector
    init <- 1:3
    x <- rep(init, length.out=100)
    y <- rep_vt(init, length.out=100)

    # Check that their elements are equal
    x == y[]

[Package matter version 1.16.0 Index]