| Type: | Package |
| Title: | Converts Tabular Data to Interleaved Vectors |
| Version: | 0.1.2 |
| Date: | 2024-01-18 |
| Description: | Converts matrices and lists of matrices into a single vector by interleaving their values. That is, each element of the result vector is filled from the input matrices one row at a time. This is the same as transposing a matrix, then removing the dimension attribute, but is designed to operate on matrices in nested list structures. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.2.3 |
| Depends: | R (≥ 3.0.2) |
| LinkingTo: | geometries (≥ 0.2.4), Rcpp |
| Imports: | Rcpp |
| Suggests: | covr, sfheaders, tinytest |
| NeedsCompilation: | yes |
| Packaged: | 2024-01-17 23:38:07 UTC; dave |
| Author: | David Cooley [aut, cre], Mapbox [cph] (author of header library earcut.hpp) |
| Maintainer: | David Cooley <david.cooley.au@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2024-01-17 23:50:02 UTC |
Interleave
Description
Converts matrices and lists of matrices into a vector. The elements of the vector are taken from the matrices one row at a time.
Usage
interleave(x)
Arguments
x |
object to interleave |
Value
vector of interleaved values
Examples
## matrix (this is equivalent to a LINESTRING in spatial structures)
m1 <- matrix(1:20, ncol = 2, byrow = TRUE )
interleave( m1 )
## This is the same as transposing and removing the 'dim' attribute
tm <- t(m1)
attr( tm, "dim" ) <- NULL
all( interleave( m1 ) == tm )
## list of matrices (this is equivalent to a POLYGON in spatial structures)
m2 <- matrix(20:1, ncol = 2, byrow = TRUE )
l <- list( m1, m2 )
interleave( l )
## nested list of matrices
l <- list( m1, list( list( m2 ) ) )
interleave( l )