Skip to content

Instantly share code, notes, and snippets.

@mskyttner
Created January 11, 2024 17:54
Show Gist options
  • Save mskyttner/205676fae6fbf991cf7812f0cd75aaa0 to your computer and use it in GitHub Desktop.
Save mskyttner/205676fae6fbf991cf7812f0cd75aaa0 to your computer and use it in GitHub Desktop.
Cookies returned?
---
title: "Quarto Dashboard Layout"
format: dashboard
---
## Row {height=50%}
### Column {.tabset}
```{r}
#| title: Tab 1
"Tab 1 content"
```
```{r}
#| title: Tab 2
"Tab 2 content"
```
```{r}
#| title: Tab 3
"Tab 3 content"
```
### Column
```{r}
#| fig-title: "Cookies returned"
library(magick)
library(knitr)
library(htmltools)
dat <- data.frame(Cookies = "Cookies returned")
img_cookies <- function() {
on.exit(unlink("/tmp/img.png"))
my_img <-
paste0("https://cloud.githubusercontent.com/assets/",
"51676/15612571/bdc152fc-2448-11e6-8235-95ebcac7114c.png") |>
image_read() |>
image_crop("365x285+20+40", gravity = "NorthEast") |>
image_annotate(text = "COOKIES\nRETURNED",
size = 50, color = "red", location = "+50+50") |>
image_write("/tmp/img.png")
image_uri("/tmp/img.png")
}
new_img <- div(
style = "padding: 1rem; display: inline-block, width: 100%;",
img(src = img_cookies(), height = "100%", alt = "cookies")
)
reactable::reactable(
data = dat,
details = function(index) new_img
)
```
## Row {height=50%}
```{r}
"Some more content"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment