Learn R Programming

cgwtools (version 4.1)

inverse.seqle: 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)

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....

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.

Author

Carl Witthoft, carl@witthoft.com

See Also

seqle , inverse.rle

Examples

Run this code

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

Run the code above in your browser using DataLab