Created
November 20, 2019 23:46
-
-
Save RickPack/c28f1b0e3ea569374ce23caae9c1d820 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Stack Overflow Consecutive PNG" | |
author: "Rick Pack" | |
date: "11/20/2019" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` | |
## Dummy header | |
```{r png_copy, echo=FALSE} | |
for (q in 1:5) { | |
file.copy(list.files(system.file("img", package = "png"), | |
full.names = TRUE), | |
getwd()) | |
file.rename("Rlogo.png", paste0("Rlogo_",q,".png")) | |
} | |
``` | |
# Only one R logo shown instead of the five available | |
```{r png_show, echo=FALSE} | |
library(png) | |
# Providing the folder so you can delete the png files | |
# created above | |
print(getwd()) | |
all_img <- list.files(full.names = TRUE)[grepl( | |
"Rlogo", list.files())] | |
for (j in 1:length(all_img)) { | |
grid::grid.raster(readPNG(all_img[j])) | |
writeLines("\n") | |
cat('\r\n\r\n') | |
cat("\n\n\\pagebreak\n") | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment