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
```{r} | |
library(ggiraph) | |
library(tidyverse) | |
library(patchwork) | |
library(shiny) | |
library(gt) | |
``` | |
## Prep work for the Shiny app |
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
## Renaming long names | |
Load `tidyverse` and data from TidyTuesday. | |
```{r} | |
library(tidyverse) | |
big_tech_companies <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-07/big_tech_companies.csv') | |
big_tech_companies | |
# # A tibble: 14 × 2 |
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
```{r} | |
setwd(here::here('democracy_index')) | |
library(tidyverse) | |
library(shadowtext) | |
library(ggiraph) | |
library(ggtext) | |
library(gdtools) | |
register_gfont("Roboto Mono") |
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
## No styling app | |
```{r} | |
setwd(here::here()) | |
library(shiny) | |
library(tidyverse) | |
penguins <- palmerpenguins::penguins |> filter(!is.na(sex)) | |
# Define UI |
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
library(tidyverse) | |
library(gt) | |
circle <- '<span style=" | |
display: inline-block; | |
background-color: pink; | |
width: 1cm; | |
height: 1cm; | |
border-radius: 100%; | |
border: black 1px solid; |
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
library(gt) | |
library(tidyverse) | |
tribble( | |
~flag, ~country, ~population, | |
'DE', 'Germany', 84270625, | |
'US', 'United States', 333287557, | |
'IE', 'Italy', 58853482, | |
'GY', 'Guyana', 795408, | |
'NO', 'Norway', 5488984, | |
'GH', 'Ghana', 32103042 |
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
setwd(here::here('02_shiny_modules')) | |
library(shiny) | |
library(ggplot2) | |
ui <- fluidPage( | |
theme = bslib::bs_theme(bootswatch = 'flatly'), | |
tabsetPanel( | |
tabPanel("Penguins", { | |
sidebarLayout( |
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
```{r} | |
library(tidyverse) | |
library(showtext) | |
library(ggtext) | |
font_add('fa-solid', '00_fonts/Font Awesome 6 Free-Solid-900.otf') | |
showtext_auto() | |
showtext_opts(dpi = 300) |
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
library(shiny) | |
library(bslib) | |
library(bsicons) | |
ui <- fluidPage( | |
theme = bslib::bs_theme(), | |
h1('One Box'), | |
fluidRow( | |
column( |
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
library(tidyverse) | |
tooth_data <- ToothGrowth |> | |
as_tibble() |> | |
mutate(dose = factor(dose)) | |
tooth_data_relabeled <- tooth_data |> | |
mutate( | |
supp = if_else( | |
supp == 'VC', 'Vitamin C supplement', 'Orange Juice' | |
) |