Skip to content

Commit

Permalink
test1
Browse files Browse the repository at this point in the history
  • Loading branch information
belinskyc committed Oct 29, 2024
0 parents commit 438536a
Show file tree
Hide file tree
Showing 207 changed files with 454,852 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
7 changes: 7 additions & 0 deletions myapp/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Title: Hello Shiny!
Author: RStudio, Inc.
AuthorUrl: http://www.rstudio.com/
License: MIT
DisplayMode: Showcase
Tags: getting-started
Type: Shiny
3 changes: 3 additions & 0 deletions myapp/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This small Shiny application demonstrates Shiny's automatic UI updates.

Move the *Number of bins* slider and notice how the `renderPlot` expression is automatically re-evaluated when its dependant, `input$bins`, changes, causing a histogram with a new number of bins to be rendered.
59 changes: 59 additions & 0 deletions myapp/app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
library(shiny)

# Define UI for app that draws a histogram ----
ui <- fluidPage(

# App title ----
titlePanel("Hello Shiny!"),

# Sidebar layout with input and output definitions ----
sidebarLayout(

# Sidebar panel for inputs ----
sidebarPanel(

# Input: Slider for the number of bins ----
sliderInput(inputId = "bins",
label = "Number of bins:",
min = 1,
max = 50,
value = 30)

),

# Main panel for displaying outputs ----
mainPanel(

# Output: Histogram ----
plotOutput(outputId = "distPlot")

)
)
)

# Define server logic required to draw a histogram ----
server <- function(input, output) {

# Histogram of the Old Faithful Geyser Data ----
# with requested number of bins
# This expression that generates a histogram is wrapped in a call
# to renderPlot to indicate that:
#
# 1. It is "reactive" and therefore should be automatically
# re-executed when inputs (input$bins) change
# 2. Its output type is a plot
output$distPlot <- renderPlot({

x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)

hist(x, breaks = bins, col = "#75AADB", border = "white",
xlab = "Waiting time to next eruption (in mins)",
main = "Histogram of waiting times")

})

}

# Create Shiny app ----
shinyApp(ui = ui, server = server)
13 changes: 13 additions & 0 deletions shinyLive.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX
1 change: 1 addition & 0 deletions site/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name":"app.R","content":"library(shiny)\n\n# Define UI for app that draws a histogram ----\nui <- fluidPage(\n\n # App title ----\n titlePanel(\"Hello Shiny!\"),\n\n # Sidebar layout with input and output definitions ----\n sidebarLayout(\n\n # Sidebar panel for inputs ----\n sidebarPanel(\n\n # Input: Slider for the number of bins ----\n sliderInput(inputId = \"bins\",\n label = \"Number of bins:\",\n min = 1,\n max = 50,\n value = 30)\n\n ),\n\n # Main panel for displaying outputs ----\n mainPanel(\n\n # Output: Histogram ----\n plotOutput(outputId = \"distPlot\")\n\n )\n )\n)\n\n# Define server logic required to draw a histogram ----\nserver <- function(input, output) {\n\n # Histogram of the Old Faithful Geyser Data ----\n # with requested number of bins\n # This expression that generates a histogram is wrapped in a call\n # to renderPlot to indicate that:\n #\n # 1. It is \"reactive\" and therefore should be automatically\n # re-executed when inputs (input$bins) change\n # 2. Its output type is a plot\n output$distPlot <- renderPlot({\n\n x <- faithful$waiting\n bins <- seq(min(x), max(x), length.out = input$bins + 1)\n\n hist(x, breaks = bins, col = \"#75AADB\", border = \"white\",\n xlab = \"Waiting time to next eruption (in mins)\",\n main = \"Histogram of waiting times\")\n\n })\n\n}\n\n# Create Shiny app ----\nshinyApp(ui = ui, server = server)\n","type":"text"},{"name":"DESCRIPTION","content":"Title: Hello Shiny!\nAuthor: RStudio, Inc.\nAuthorUrl: http://www.rstudio.com/\nLicense: MIT\nDisplayMode: Showcase\nTags: getting-started\nType: Shiny\n","type":"text"},{"name":"Readme.md","content":"This small Shiny application demonstrates Shiny's automatic UI updates. \n\nMove the *Number of bins* slider and notice how the `renderPlot` expression is automatically re-evaluated when its dependant, `input$bins`, changes, causing a histogram with a new number of bins to be rendered.\n","type":"text"}]
11 changes: 11 additions & 0 deletions site/edit/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Redirect to editable app</title>
<meta
http-equiv="refresh"
content="0;URL='../index.html?_shinylive-mode=editor-terminal-viewer'"
/>
</head>
<body></body>
</html>
28 changes: 28 additions & 0 deletions site/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shiny App</title>
<script
src="./shinylive/load-shinylive-sw.js"
type="module"
></script>
<script type="module">
import { runExportedApp } from "./shinylive/shinylive.js";
runExportedApp({
id: "root",
appEngine: "r",
relPath: "",
});
</script>
<link rel="stylesheet" href="./shinylive/style-resets.css" />
<link rel="stylesheet" href="./shinylive/shinylive.css" />

</head>
<body>

<div style="height: 100vh; width: 100vw" id="root"></div>

</body>
</html>
Loading

0 comments on commit 438536a

Please sign in to comment.