inverse.seqle {cgwtools}R Documentation

Inverse of seqle

Description

As with inverse.rle, this function reverses the compression performed with seqle so long as you know the incr value used to generate the compressed data.

Usage

inverse.seqle(x, incr = 1L)

Arguments

x

An object of class rle

incr

The increment between elements used to generate the compressed data object. Note that this can be either integer or float. For floating-point sequences, the reconstruction of the original series may differ at the level of floating-point precision used to generate the input object.

Value

a vector of values identical (or nearly so, for floats) to the original sequence. Note: Since the concept of "increment" has no reliable meaning when dealing with characters or char strings, when x is non-numeric the argument incr is ignored and the function reverts to base::inverse.rle....

Note

The bulk of the code is taken directly from base::inverse.rle . Thanks to "flodel" on StackOverflow for suggesting code to handle floating-point increments.

Author(s)

Carl Witthoft, carl@witthoft.com

See Also

seqle , inverse.rle

Examples


x<- c(2,2,2,3:8,8,8,4,4,4,5,5.5,6)
y<-seqle(x,incr=0)
inverse.seqle(y,0)
y <- seqle(x,incr=1)
inverse.seqle(y)
inverse.seqle(y,2) # not what you wanted

[Package cgwtools version 4.1 Index]