rep_vt-class {matter} | R Documentation |
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.
## Instance creation rep_vt(x, times, length.out = length(x) * times) ## Additional methods documented below
x |
A vector (of any mode). |
times |
The number of times to repeat the whole vector. |
length.out |
The desired length of the result. |
An object of class rep_vt
.
data
:The original vector.
length
:The expected length of the repeated virtual vector.
rep_vt
instances can be created through rep_vt()
.
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.
Kylie A. Bemis
[base]{rep}
## 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[]