diff --git a/images/bioclimatic-atlas.png b/images/bioclimatic-atlas.png new file mode 100644 index 0000000..d3d7eca Binary files /dev/null and b/images/bioclimatic-atlas.png differ diff --git a/images/components.png b/images/components.png new file mode 100644 index 0000000..9846378 Binary files /dev/null and b/images/components.png differ diff --git a/images/engineering-shiny.jpeg b/images/engineering-shiny.jpeg new file mode 100644 index 0000000..5bd7148 Binary files /dev/null and b/images/engineering-shiny.jpeg differ diff --git a/images/layouts.png b/images/layouts.png new file mode 100644 index 0000000..29736d9 Binary files /dev/null and b/images/layouts.png differ diff --git a/images/shiny-cover.png b/images/shiny-cover.png new file mode 100644 index 0000000..7b628ec Binary files /dev/null and b/images/shiny-cover.png differ diff --git a/images/shiny-reactive.png b/images/shiny-reactive.png new file mode 100644 index 0000000..8a7564f Binary files /dev/null and b/images/shiny-reactive.png differ diff --git a/images/shiny-repo.png b/images/shiny-repo.png new file mode 100644 index 0000000..39d3e33 Binary files /dev/null and b/images/shiny-repo.png differ diff --git a/images/zeplacetobe.png b/images/zeplacetobe.png new file mode 100644 index 0000000..c83dd54 Binary files /dev/null and b/images/zeplacetobe.png differ diff --git a/index.html b/index.html index c00a11b..ee1fd4a 100644 --- a/index.html +++ b/index.html @@ -409,7 +409,7 @@

Sharing code & tools

-

Research compendium, R package, Shiny App & website

+

Research compendium, R Package & Shiny App

October 2024

@@ -484,14 +484,13 @@

Table of contents

+
+

Shiny App

-
-

-

Others

@@ -968,10 +967,10 @@

What’s an R Package?


-

As of today (2024-10-30):

+

As of today (2024-10-31):

@@ -1344,26 +1343,265 @@

Must-read resources

  Shiny App

-
-

Shiny App

-

Coming soon…

- -
-
-
-

  Others

+
+

shiny package

+
+

Shiny is an package that makes it easy to build interactive web applications (apps) straight from .

+
+
+

Source: Mastering Shiny

+
+
+


+

Features

+
    +
  • Provides a curated set of user interface (UI) functions that generate the HTML, CSS, and JavaScript needed for common tasks.

    +

     No knowledge of HTML, CSS, or JavaScript required

  • +
+
+
+


+
    +
  • Introduces a new style of programming called reactive programming which automatically tracks the dependencies of pieces of code.

    +

     Automatically update output if input changes

  • +
+
+
+
+

shiny package

+
+
+

+
+
+


+

Available at: https://github.com/rstudio/shiny/

+
+
+

Structure of a Shiny App

+

A Shiny app is contained in a single script called app.R and has three components:

+
    +
  • a ui (user interface) object
  • +
  • a server() function
  • +
  • a call to the shinyApp() function
  • +
+


+
+
+
+
## Required package ----
+
+library(shiny)
+
+
+## User interface ----
+
+ui <- *(
+  ...
+)
+
+
+## Server component ----
+
+server <- function(input, output) {
+  ...
+}
+
+
+## Create Shiny app object ----
+
+shinyApp(ui = ui, server = server)
+
+
+
+ +
-
-

Others

-

Coming soon…

+
+

Structure of a Shiny App

+

A Shiny app is contained in a single script called app.R and has three components:

+
    +
  • a ui (user interface) object
  • +
  • a server() function
  • +
  • a call to the shinyApp() function
  • +
+


+
+
+
+
## Required package ----
+
+library(shiny)
+
+
+## User interface ----
+
+ui <- *(
+  ...
+)
+
+
+## Server component ----
+
+server <- function(input, output) {
+  ...
+}
+
+
+## Create Shiny app object ----
+
+shinyApp(ui = ui, server = server)
+
+
+ +
+





+
+
## Launch the Shiny app ----
+
+runApp()
+
+
+
+
+

UI Components

+
+
+

+
+
+


+

 More information here

+
+
+

UI Layouts

+
+
+

+
+
+


+

 More information here

+
+
+

Reactive programming

+
+
+

+
Graph of dependencies
+
+
+


+
    +
  • User interacts with UI inputs (click a button, enter text, select an option, etc.)
  • +
  • The server handles input changes and modifies the output value
  • +
  • The server updates the UI output
  • +
+
+
+

Minimal Shiny app

+
+
+
+
## User interface ----
+
+ui <- fluidPage(
+
+    # Application title
+    titlePanel("Old Faithful Geyser Data"),
+
+    # Sidebar with a slider input for number of bins 
+    sidebarLayout(
+        sidebarPanel(
+            sliderInput("bins",
+                        "Number of bins:",
+                        min   = 1,
+                        max   = 50,
+                        value = 30
+            )
+        ),
+
+        # Show a plot of the generated distribution
+        mainPanel(
+           plotOutput("distPlot")
+        )
+    )
+)
+
+
+
+
## Server logic ----
+
+server <- function(input, output) {
+
+    output$distPlot <- renderPlot({
+      
+        # Generate bins based on input$bins
+        x    <- faithful[, 2]
+        bins <- seq(min(x), max(x), length.out = input$bins + 1)
+
+        # Draw the histogram with the specified number of bins
+        hist(x, breaks = bins, col = 'darkgray', border = 'white',
+             xlab = 'Waiting time to next eruption (in mins)',
+             main = 'Histogram of waiting times')
+    })
+}
+
+


+
+
## Create the application ----
+
+shinyApp(ui = ui, server = server)
+
+
+


+
+

 RStudio IDE: New Project > New Directory > Shiny Application

+
+
+
+

Examples

+ +
+
+

Resources

+

 Shiny website

+


+
+
+

+
+

+
+ +
+
+

Thanks

-
+
+