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

https://github.com/multimeric/altrepr

Tools for exploring and working with ALTREP objects in R
https://github.com/multimeric/altrepr

altrep r

Last synced: 9 months ago
JSON representation

Tools for exploring and working with ALTREP objects in R

Awesome Lists containing this project

README

          

---
output: github_document
---

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

# altrepr

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/altrepr)](https://CRAN.R-project.org/package=altrepr)

`altrepr` shines light on the enigmatic ALTREP (Alernate Representation) objects in R.

It offers:

* Inspection of ALTREP types
* Specialized constructors and inspections for the 4 built-in ALTREP classes in R
* Detailed vignettes that explore these classes, how to use them in R, and
their internal workings

## Installation

You can install the development version of altrepr like so:

``` r
remotes::install_github("multimeric/altrepr")
```

## Example

```{r example}
library(altrepr)
```

`1:5` is just a normal integer vector right? Wrong! It's a sneaky ALTREP
masquerading as an integer vector.

```{r}
x <- 1:5
is_altrep(x)
```

With `altrepr` we can dig into the details:
```{r}
alt_details(x)
```
```{r}
compact_details(x)
```

And, if we're feeling brave, we can even edit the ALTREP:
```{r}
set_alt_data1(x, c(10, 1, 1))
x
```

For more information, refer to the detailed vignettes!