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('shiny_modules')) | |
library(shiny) | |
library(ggplot2) | |
data_viewer_UI <- function(id, my_data_set) { | |
ns <- NS(id) | |
tagList( | |
sidebarLayout( | |
sidebarPanel( |
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
--- | |
output: html_document | |
editor_options: | |
chunk_output_type: console | |
--- | |
```{r} | |
setwd(here::here('religions_usa')) | |
library(tidyverse) |
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(ggplot2) | |
library(dplyr) | |
ui <- fluidPage( | |
shinyjs::useShinyjs(), | |
theme = bslib::bs_theme( | |
# Colors (background, foreground, primary) | |
bg = 'white', | |
fg = '#06436e', |
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
--- | |
output: html_document | |
editor_options: | |
chunk_output_type: console | |
--- | |
```{r} | |
#| dpi: 300 | |
#| fig-height: 5 |
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(ggplot2) | |
library(grid) | |
library(ggpp) | |
rect_gr <- grid.rect( | |
gp = gpar( | |
col = NA, | |
fill = linearGradient( | |
colours = thematic::okabe_ito(2), | |
# Units is npc (so values between 0 and 1) | |
x1 = 1, y1 = 1, |
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
--- | |
output: html_document | |
editor_options: | |
chunk_output_type: console | |
--- | |
This code is adjusted from Tanya Shapiro. | |
See https://github.com/tashapiro/TidyTuesday/blob/master/2022/W40/iphone-apps.R |
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
Load packages | |
```{r} | |
library(tidyverse) | |
library(gt) | |
library(gtExtras) | |
library(svglite) # necessary for some gtExtras feature that {renv} seems to not detect otherwise | |
``` |
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
Add emojis and icons via the `emoji` package. | |
```{r} | |
library(tidyverse) | |
library(gt) | |
vegetables <- tibble( | |
Vegetable = c('eggplant', 'cucumber', 'broccoli', 'garlic', 'onion') | |
) |> | |
mutate( | |
Emoji = map_chr(Vegetable, emoji::emoji), |
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) | |
filtered_penguins <- palmerpenguins::penguins |> | |
filter(!is.na(sex)) | |
penguin_weights <- palmerpenguins::penguins |> | |
filter(!is.na(sex)) |> | |
group_by(species) |> | |
summarise( |
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
Original table at https://codepen.io/supacode/pen/ExjbmgG | |
```{r} | |
library(tidyverse) | |
library(gt) | |
levels <- c('Standard', 'Popular', 'Golden', 'Ultimate') | |
prices <- c(15, 25, 35, 50) | |
names(prices) <- levels | |
features <- c('Beginner Classes', 'Training Overview', 'Personal Training', 'Olympic Weightlifting', 'Foundation Training') |