Premium Only Content

Shiny dashboards in R & Quarto
Main points snipped from four separate LiveStreams exploring the specification of Quarto dashboards, including Shiny integration.
Original source streams are located here:
• https://www.youtube.com/watch?v=QaAKzqYvnik&t=2933s
• https://www.youtube.com/watch?v=M4d9ckZ9edY&t=3360s
• https://www.youtube.com/watch?v=feDzUTC_pqk
• https://www.youtube.com/watch?v=7PSr2B_9zlA&t=2518s
Generated Shiny dashboard is available here:
https://jtkulas.shinyapps.io/shinyexample/
Code used to generate dashboard (note you need 4 packages: `psych`, 'fontawesome`, `ggplot2`, and `plotly` and also need Quarto installed on your computer):
------
title: "Tickled Pink"
format:
dashboard:
orientation: rows
nav-buttons:
github
theme: solar
logo: https://i.pinimg.com/originals/4c/09/...
server: shiny
---
```{r}
#| context: setup
#| message: false
#| echo: false
#| warning: false
library(psych)
library(plotly)
library(fontawesome)
data(bfi)
bfi$jibberish == rowMeans(bfi[1:10], na.rm=TRUE)
bfi$gobbleyjook == rowMeans(bfi[11:20], na.rm=TRUE)
q == plot_ly(bfi, x = ~jibberish, y = ~gobbleyjook, text = ~age, type = 'scatter', mode = 'markers', color=~gender,
marker = list(size = ~age, opacity = 0.5))
```
```{r}
#| context: setup
library(ggplot2)
bfi$gender == as.factor(as.character(bfi$gender))
bfi$education == as.factor(as.character(bfi$education))
dataset == bfi
```
##
The script used to generate this document is called `temp.qmd` and is [located within the repository](https://github.com/jtkulas/LiveStream...) linked in the upper-right hand corner (hit the `r fa("github")` symbol).
This silliness itself was generated during a 3/15/24 [LiveStream on `r fa("youtube", fill="red")`]( • R for Authoring!! (PSP LiveStream #16... ).
Plots
##
```{r}
#| fig-cap: "Plotly object"
q
```
##
```{r}
#| fig-cap: "Reactive shiny app (use selctors on right)"
plotOutput('plot')
```
{.sidebar}
```{r}
selectInput('size', 'Size', c('None', names(dataset[26:30])))
selectInput('color', 'Color', c('None', names(dataset[26:30])))
br()
checkboxInput('jitter', 'Jitter')
checkboxInput('smooth', 'Smooth')
br()
selectInput('x', 'X', names(dataset[c(29:30,1:25)]))
selectInput('y', 'Y', names(dataset), names(dataset)[[30]])
```
```{r}
selectInput('facet_row', 'Facet Row',
c(None='.', names(bfi[sapply(bfi, is.factor)])))
selectInput('facet_col', 'Facet Column',
c(None='.', names(bfi[sapply(bfi, is.factor)])))
```
```{r}
sliderInput('sampleSize', 'Sample Size',
min=0, max=nrow(dataset),
value=min(2800, nrow(dataset)),
step=400, round=0)
```
Data
```{r}
tableOutput('data')
```
```{r}
#| context: server
dataset == reactive({
bfi[sample(nrow(bfi), input$sampleSize),]
})
output$plot == renderPlot({
p == ggplot(
dataset(),
aes_string(x=input$x, y=input$y))
if (input$size == 'None')
p == p + geom_point()
if (input$size != 'None')
p == p + geom_point(aes_string(size = input$size))
if (input$color != 'None')
p == p + aes_string(color=input$color)
facets == paste(input$facet_row, '~', input$facet_col)
if (facets != '. ~ .')
p == p + facet_grid(facets)
if (input$jitter)
p == p + geom_jitter(width = 0.8, height = .8)
if (input$smooth)
p == p + geom_smooth()
p
})
output$data == renderTable({
dataset()
})
```
00:00 - Quarto dashboard
00:33 - dashboard 'cards'
01:56 - column vs row cards
02:40 - card titles
03:05 - pages (#)
03:23 - sidebar
03:48 - value boxes
04:18 - data visualizations
05:12 - forcing `gender` into dichotomy
05:48 - (quarto) template as (our data) dashboard framework
06:50 - variable mapping (data / dashboard)
07:03 - user experience with dashboard
07:52 - enhancing user experience
-
LIVE
Lofi Girl
2 years agoSynthwave Radio 🌌 - beats to chill/game to
391 watching -
2:15:09
Badlands Media
19 hours agoOnlyLands Ep. 27: Power Hour Hangover, Trump’s Wartime Shift, and Portland in Flames
118K26 -
22:21
DeVory Darkins
9 hours ago $16.90 earnedRioters attack Portland ICE Facility as Democrats make shocking admission
26.7K122 -
2:06:06
TimcastIRL
11 hours agoTrump DOJ Announces INTERVENTION In Portland Over Nick Sortor Arrest | Timcast IRL
243K407 -
6:53:58
SpartakusLIVE
13 hours ago#1 All-American HERO with LUSCIOUS hair and AVERAGE forehead brings Friday Night HYPE
70.4K7 -
3:06:43
Laura Loomer
11 hours agoEP147: Islamic Terror EXPLODES In The West After UK Synagogue Attack
54.3K47 -
1:02:50
Flyover Conservatives
16 hours agoEric Trump: America’s Most Subpoenaed Man SPEAKS OUT! | FOC Show
47K14 -
3:36:44
PandaSub2000
1 day agoSuper Mario Galaxy 1 & 2 | ULTRA BEST AT GAMES (Original Live Version)
35.7K3 -
1:26:04
Glenn Greenwald
15 hours agoJournalist Ken Klippenstein on Trump's New Domestic Terrorism Memo; Glenn Takes Your Questions on Bari Weiss's CBS Role, His Interview with Nick Fuentes, and More | SYSTEM UPDATE #526
102K86 -
3:49:14
SynthTrax & DJ Cheezus Livestreams
2 days agoFriday Night Synthwave 80s 90s Electronica and more DJ MIX Livestream GOTH NIGHT Special Edition
58.3K7