https://github.com/mcanouil/hex-stickers
Hex Stickers from R Packages or R Shiny Application.
https://github.com/mcanouil/hex-stickers
hex-stickers
Last synced: about 1 month ago
JSON representation
Hex Stickers from R Packages or R Shiny Application.
- Host: GitHub
- URL: https://github.com/mcanouil/hex-stickers
- Owner: mcanouil
- License: cc0-1.0
- Created: 2020-01-13T10:29:53.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-04-14T08:09:38.000Z (about 3 years ago)
- Last Synced: 2025-01-23T22:48:59.298Z (3 months ago)
- Topics: hex-stickers
- Homepage:
- Size: 9.26 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - mcanouil/hex-stickers - Hex Stickers from R Packages or R Shiny Application. (Others)
README
---
output: github_document
---# hex-stickers
[](LICENSE)
```{r, echo = FALSE, message = FALSE}
library(magick)
logos <- sub("\\.png$", "", dir("PNG", pattern = "\\.png$"))
png <- paste0("PNG/", logos, ".png")
svg <- paste0("SVG/", logos, ".svg")
thumb <- paste0("thumbs/", logos, ".png")resize <- function(path_in, path_out) {
image <- image_read(path_in)
image <- image_resize(image, "278x")
image_write(image, path_out)
}outdated <- !file.exists(thumb) | file.mtime(thumb) < file.mtime(png)
invisible(Map(resize, png[outdated], thumb[outdated]))
``````{r, results = "asis", echo = FALSE}
img <- glue::glue('')
png_link <- glue::glue('{logos}.png')
svg_link <- glue::glue('{logos}.svg')
cell <- paste0('', img, "
", png_link, "
", svg_link, "")cols <- 5
rows <- ceiling(length(cell) / cols)row_id <- rep(seq_len(rows), each = cols, length.out = length(cell))
row_cells <- split(cell, row_id)cat("\n")
cat(paste0("", sapply(row_cells, paste, collapse = ""), ""), sep = "")
cat("\n")
``````{r, results = "asis", echo = FALSE}
library(gifski)
ratio <- 3 # 2210/120
gif_hex <- gifski(
png_files = list.files("PNG", pattern = "png$", full.names = TRUE),
gif_file = "hex-stickers.gif",
delay = 1,
width = 2210 / ratio,
height = 2557 / ratio,
loop = TRUE,
progress = FALSE
)
```