README.md

ggmemory

The goal of ggmemory is to present code and output as it was executed in an interactive session; support is currently focused on data manipulation pipelines and data visualization.

How.

library(magrittr)
#> Warning: package 'magrittr' was built under R version 3.6.2
'library(ggplot2)
ggplot(data = cars) +
  aes(x = speed) +
  aes(y = dist) +
  geom_point(color = "magenta")
ggplot(data = cars) +
  aes(x = speed) +
  aes(y = dist) +
  geom_point(color = "magenta",
             size = 8)
ggplot(data = cars) +
  aes(x = speed) +
  aes(y = dist) +
  geom_point(color = "magenta",
             size = 8,
             alpha = .5)' %>% 
  ggmemory::r_code_extract_code_list(code = .)
#> [[1]]
#> [1] "library(ggplot2)"
#> 
#> [[2]]
#> [1] "ggplot(data = cars) +"             "  aes(x = speed) +"               
#> [3] "  aes(y = dist) +"                 "  geom_point(color = \"magenta\")"
#> 
#> [[3]]
#> [1] "ggplot(data = cars) +"             "  aes(x = speed) +"               
#> [3] "  aes(y = dist) +"                 "  geom_point(color = \"magenta\","
#> [5] "             size = 8)"           
#> 
#> [[4]]
#> [1] "ggplot(data = cars) +"             "  aes(x = speed) +"               
#> [3] "  aes(y = dist) +"                 "  geom_point(color = \"magenta\","
#> [5] "             size = 8,"            "             alpha = .5)"
'library(ggplot2)
ggplot(data = cars) +
  aes(x = speed) +
  aes(y = dist) +
  geom_point(color = "magenta")
ggplot(data = cars) +
  aes(x = speed) +
  aes(y = dist) +
  geom_point(color = "magenta",
             size = 8)' %>% 
  ggmemory::r_code_extract_code_list(code = .) ->
my_executions

flipbookr::chunk_reveal(code_seq = my_executions)

Steps 3-5 might be bundled up in the future.

Precidents and Motivation.

flipbookr was designed to present curated code pipelines or code experiences (rotating arguments). Consumers can see how you might build up a chart or data manipulation pipeline. However, the experiences are rather curated, and not true to how data manipulation is actually conduction – probably not as linear as the ‘classic flipbookr’ presentations.

Moreover, action within lines – for example changing color of a point geom or size: geom_point() -> geom_point(size = 12) – is tricky to demonstrate using classic {flipbookr} presentations. Motivation for working on {memory} are other packages, whose within-line changes are where important points of decision: {ggstamp} and {ggsample}.

Related work.

A cool package also doing work in this area – data analytics evolution – is {camcorder}. Once the ‘camcorder’ is turned on, this package saves all capture all data visualizations produced in an interactive session. Then, these are reproduced together in a gif.



EvaMaeRey/ggmemory documentation built on Dec. 17, 2021, 7:25 p.m.