├── .gitignore ├── 00_installation.R ├── 01_01_structure.R ├── 01_02_sidebar_layout.R ├── 01_03_input_controllers.R ├── 01_04_observers.R ├── 01_99_exercise.R ├── 02_00_app.R ├── 02_01_renders.R ├── 02_02_validation.R ├── 02_03_reactive_value.R ├── 02_04_hiding_content.R ├── 02_99_exercise.R ├── 03_00_app.R ├── 03_01_modal.R ├── 03_02_dynamic_ui.R ├── 03_99_exercise.R ├── 04_00_app.R ├── 04_01_modules.R ├── 04_02_modules_communication.R ├── 04_99_exercise.R ├── 05_00_app.R ├── 05_01_rest_api.R ├── 05_02_css.R ├── 05_03_js.R ├── 05_99_exercise.R ├── 06_00_app.R ├── app.R ├── conference-workshop.Rproj ├── tools.R └── www ├── alert.js ├── custom.css ├── hidden_mode.js └── simple.css /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | rsconnect 6 | -------------------------------------------------------------------------------- /00_installation.R: -------------------------------------------------------------------------------- 1 | install.packages("magrittr") 2 | install.packages("shiny") 3 | install.packages("DT") 4 | install.packages("remotes") 5 | install.packages("httr") 6 | install.packages("glue") 7 | install.packages("dplyr") 8 | install.packages("purrr") 9 | remotes::install_github("r-world-devs/shinyGizmo", ref = "dev") 10 | -------------------------------------------------------------------------------- /01_01_structure.R: -------------------------------------------------------------------------------- 1 | library(shiny) 2 | 3 | ui <- fluidPage( 4 | 5 | ) 6 | 7 | server <- function(input, output, session) { 8 | 9 | } 10 | 11 | shinyApp(ui, server) 12 | -------------------------------------------------------------------------------- /01_02_sidebar_layout.R: -------------------------------------------------------------------------------- 1 | # https://shiny.rstudio.com/articles/layout-guide.html 2 | library(shiny) 3 | 4 | ui <- fluidPage( 5 | sidebarLayout( 6 | sidebarPanel( 7 | h3("Sidebar Title"), 8 | "Sidebar" 9 | ), 10 | mainPanel( 11 | div("I'm in the main panel"), 12 | "I'm here as well" 13 | ) 14 | ) 15 | ) 16 | 17 | server <- function(input, output, session) { 18 | 19 | } 20 | 21 | shinyApp(ui, server) -------------------------------------------------------------------------------- /01_03_input_controllers.R: -------------------------------------------------------------------------------- 1 | # https://shiny.rstudio.com/gallery/widget-gallery.html 2 | 3 | library(shiny) 4 | 5 | ui <- fluidPage( 6 | actionButton( 7 | inputId = "my_button", label = "Click Me" 8 | ), 9 | numericInput( 10 | inputId = "my_number", label = "Place number here", value = 1, min = 1, max = 10, step = 1 11 | ), 12 | textInput( 13 | "my_text", label = "Place text here", value = "Default text" 14 | ), 15 | sliderInput( 16 | inputId = "my_slider_one", label = "Select number here", value = 1, min = 1, max = 10, step = 1 17 | ), 18 | sliderInput( 19 | inputId = "my_slider_two", label = "Select range here", value = c(5, 6), min = 1, max = 10, step = 1 20 | ), 21 | selectInput( 22 | inputId = "my_dropdown", label = "Choose a letter", choices = letters 23 | ) 24 | ) 25 | 26 | server <- function(input, output, session) { 27 | 28 | } 29 | 30 | shinyApp(ui, server) -------------------------------------------------------------------------------- /01_04_observers.R: -------------------------------------------------------------------------------- 1 | library(shiny) 2 | 3 | ui <- fluidPage( 4 | sliderInput( 5 | inputId = "my_slider_one", label = "Select number here", value = 1, min = 1, max = 10, step = 1 6 | ), 7 | actionButton( 8 | inputId = "my_button", label = "Click Me!" 9 | ) 10 | ) 11 | 12 | server <- function(input, output, session) { 13 | observeEvent(input$my_slider_one, { 14 | print("Slider changed") 15 | print(input[["my_slider_one"]]) 16 | }) 17 | 18 | observeEvent(input$my_button, { 19 | updateSliderInput(session, "my_slider_one", value = sample(1:10, 1)) 20 | }) 21 | } 22 | 23 | shinyApp(ui, server) -------------------------------------------------------------------------------- /01_99_exercise.R: -------------------------------------------------------------------------------- 1 | # In the below app: 2 | # 1. Modify numericInput in line 20 so that: 3 | # - its value can be accessible by input$nrow 4 | # - its initial value equals 50 5 | # 2. Create actionButton (in line 27) so that: 6 | # - its value can be accessible by input$run, 7 | # - it displays "Generate" label, 8 | # - it covers full width of its container. 9 | # Use actionButton in line 25 as an example. 10 | # 3. Create an observer (in line 40) that listens to the above button changes. 11 | # Make the observer callback print "run clicked" in the console. 12 | # 4. Run app and test it out. 13 | 14 | library(shiny) 15 | 16 | ui <- fluidPage( 17 | sidebarLayout( 18 | sidebarPanel( 19 | h3("Table Generator"), 20 | numericInput(inputId = "my_number", label = "Number of rows", value = 1, min = 1, max = 150, step = 1), 21 | div(id = "variables"), 22 | div( 23 | id = "define-vars", 24 | textInput("name", "Column name"), 25 | actionButton("new", NULL, icon = icon("plus"), width = "100%") 26 | ), 27 | #