2024-08-23

Slide 1: Title Slide

Simple Prediction App

A Shiny Application by [Elhasnaoui]

Slide 2: Introduction

What is the Simple Prediction App?

  • Objective: The app predicts a value based on a user-inputted number.
  • Use Case: This app can be used as a basic example of reactive programming in R.
  • User-Friendly: Designed for ease of use, with minimal input required.

Slide 3: How It Works

Mechanics of the Prediction

  1. User Input: The user enters a number.
  2. Processing: The app multiplies the number by 2.
  3. Output: The result is displayed instantly.
input_value <- 5  # Example input
predicted_value <- input_value * 2
predicted_value
## [1] 10

Slide 4: Demonstration

Live Demo

Enter a value in the Shiny app, click “Predict,” and see the result.

# Demonstrate the app’s functionality here
library(shiny)

ui <- fluidPage(
  numericInput("num", "Enter a number:", 1),
  actionButton("go", "Predict"),
  textOutput("result")
)

server <- function(input, output) {
  observeEvent(input$go, {
    output$result <- renderText({
      paste("Predicted Value:", input$num * 2)
    })
  })
}

shinyApp(ui = ui, server = server)
Shiny applications not supported in static R Markdown documents

Slide 5: Conclusion

Why Use This App?

Educational: A simple introduction to Shiny for beginners. Extensible: Can be modified to include more complex logic. Accessible: Easy for anyone to use, regardless of programming knowledge.