Skip to content

Instantly share code, notes, and snippets.

@djnavarro
Created March 12, 2019 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djnavarro/4c2f2935fa23621183d2f6ba167c01e4 to your computer and use it in GitHub Desktop.
Save djnavarro/4c2f2935fa23621183d2f6ba167c01e4 to your computer and use it in GitHub Desktop.
Uses the asciify package to draw the "Bayesian rain" animation in the RStudio viewer pane
#devtools::install_github("djnavarro/asciify")
library(asciify)
library(magrittr)
temporary <- function(file) {
temp_dir <- tempfile()
dir.create(temp_dir)
file.path(temp_dir, file)
}
in_viewer <- function(file) {
viewer <- getOption("viewer")
viewer(url = file)
}
loc <- temporary("bayes_rain.html")
ascii_data("bayes.png") %>%
ascii_map(rescale = .3) %>%
ascii_grid() %>%
ascii_rain(file = loc)
in_viewer(loc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment