An open API service indexing awesome lists of open source software.

https://github.com/dcooley/interleave


https://github.com/dcooley/interleave

Last synced: 7 months ago
JSON representation

Awesome Lists containing this project

README

          

---
output: github_document
editor_options:
chunk_output_type: console
---

[![R build status](https://github.com/dcooley/interleave/workflows/R-CMD-check/badge.svg)](https://github.com/dcooley/interleave/actions)
[![Codecov test coverage](https://codecov.io/gh/dcooley/interleave/branch/master/graph/badge.svg)](https://app.codecov.io/gh/dcooley/interleave?branch=master)

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#",
fig.path = "man/figures/README-",
out.width = "100%"
)

library(interleave)
```

```{r, echo = FALSE, out.height="256px", out.width="256px"}
knitr::include_graphics("./man/figures/interleaving.gif")
```

# interleave

As the amazing gif shows, **interleaving** in this context means converting a matrix into a vector, filled in a row-wise manner.

I'm building this library to be the workhorse for converting matrices (and lists of matrices) into single, interleaved vectors, ready for WebGL applications.

Here are some simple examples

```{r}

( mat1 <- matrix(1:20, ncol = 2, byrow = T) )

interleave( mat1 )

( mat2 <- matrix(20:1, ncol = 5, byrow = T) )

interleave( mat2 )

lst <- list( mat1, mat2 )

interleave( lst )

```