Skip to content

Instantly share code, notes, and snippets.

@Inkimar
Forked from ChrisBeeley/minimal.Rmd
Created July 30, 2020 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Inkimar/a44a840e62489fb883a46e4035405be3 to your computer and use it in GitHub Desktop.
Save Inkimar/a44a840e62489fb883a46e4035405be3 to your computer and use it in GitHub Desktop.
---
title: "Basic RMarkdown Shiny"
author: "Chris Beeley"
output: html_document
runtime: shiny
---
# Example RMarkdown document
This is an interactive document written in *markdown*. As you can see it is easy to include:
1. Ordered lists
2. *Italics*
3. **Bold type**
4. Links to [Documentation](http://rmarkdown.rstudio.com/authoring_shiny.html)
## This is heading two
Perhaps this introduces the visualisation below.
```{r, echo=FALSE}
sliderInput("sampleSize", label = "Size of sample",
min = 10, max = 100, value = 50, step = 1)
renderPlot({
hist(runif(input$sampleSize))
})
```
@Inkimar
Copy link
Author

Inkimar commented Jul 30, 2020

Shiny , ui.R and server.R

ui.R

library(shiny) #load shiny at beginning of both scripts

fluidPage(
  titlePanel("Minimal Application"),
  sidebarLayout(
    sidebarPanel(
      textInput(inputId = "comment",
                label ="Say something",
                value ="")),
    mainPanel(
      h3("This is you saying it"),
      textOutput("textDisplay")
    )
    )
  )

server.R

library(shiny) #load shiny at beginning of both scripts

function(input, output) {
  output$textDisplay = renderText({
    paste0("You said '", input$comment,
           "'.There are ", nchar(input$comment),  
           " characters in this.") })     
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment