https://github.com/mcanouil/rpackages
  
  
    A short introduction on building R-packages. 
    https://github.com/mcanouil/rpackages
  
presentation-slides r r-package slides
        Last synced: 8 months ago 
        JSON representation
    
A short introduction on building R-packages.
- Host: GitHub
 - URL: https://github.com/mcanouil/rpackages
 - Owner: mcanouil
 - License: cc-by-sa-4.0
 - Created: 2020-01-31T10:17:52.000Z (almost 6 years ago)
 - Default Branch: main
 - Last Pushed: 2021-10-11T09:34:48.000Z (about 4 years ago)
 - Last Synced: 2025-01-23T22:48:57.907Z (9 months ago)
 - Topics: presentation-slides, r, r-package, slides
 - Language: HTML
 - Homepage: https://m.canouil.dev/rpackages/
 - Size: 5.21 MB
 - Stars: 2
 - Watchers: 2
 - Forks: 0
 - Open Issues: 0
 - 
            Metadata Files:
            
- Readme: README.Rmd
 - License: LICENSE
 
 
Awesome Lists containing this project
- jimsghstars - mcanouil/rpackages - A short introduction on building R-packages. (HTML)
 
README
          ---
output: github_document
---
# rpackages
[](LICENSE)
This is the work-in-progress repo for the slides about rpackages.
```{r, include = FALSE}
library(magick)
library(here)
library(chromote)
library(glue)
thumb <- "thumbs/title_slide_thumb.png"
png <- sub("_thumb", "", thumb)
index_html <- here::here("docs/index.html")
if (!file.exists(thumb) | file.mtime(thumb) < file.mtime(index_html)) {
  web_browser <- suppressMessages(try(chromote::ChromoteSession$new(), silent = TRUE))
  if (inherits(web_browser, "try-error") && Sys.info()[["sysname"]] == "Windows") {
    edge_path <- "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
    if (file.exists(edge_path)) {
      Sys.setenv(CHROMOTE_CHROME = edge_path)
      web_browser <- chromote::ChromoteSession$new()
    } else {
      stop('Please set Sys.setenv(CHROMOTE_CHROME = "Path/To/Chrome")')
    }
  }
  web_browser$Page$navigate(index_html, wait_ = FALSE)
  page_browser <- web_browser$Page$loadEventFired()
  web_browser$screenshot(
    filename = png,
    selector = "div.remark-slide-scaler",
    scale = 2
  )
  web_browser$close()
  
  resize <- function(path_in, path_out) {
    image <- image_read(path_in)
    image <- image_resize(image, "384x")
    image_write(image, path_out)
  }
  resize(png, thumb)
}
```