rajistics commited on
Commit
de48a7e
1 Parent(s): 69a337d
Files changed (4) hide show
  1. app.R +30 -1
  2. euler/server.R +0 -20
  3. euler/ui.R +0 -19
  4. shiny-server.conf +0 -21
app.R CHANGED
@@ -1,10 +1,39 @@
1
  library(shiny)
2
 
 
3
  ui <- fluidPage(
4
- titlePanel("Example Shiny Application")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  )
6
 
 
7
  server <- function(input, output) {
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
  shinyApp(ui = ui, server = server)
 
1
  library(shiny)
2
 
3
+ # Define UI for application that draws a histogram
4
  ui <- fluidPage(
5
+
6
+ # Application title
7
+ titlePanel("Old Faithful Geyser Data"),
8
+
9
+ # Sidebar with a slider input for number of bins
10
+ sidebarLayout(
11
+ sidebarPanel(
12
+ sliderInput("bins",
13
+ "Number of bins:",
14
+ min = 1,
15
+ max = 50,
16
+ value = 30)
17
+ ),
18
+
19
+ # Show a plot of the generated distribution
20
+ mainPanel(
21
+ plotOutput("distPlot")
22
+ )
23
+ )
24
  )
25
 
26
+ # Define server logic required to draw a histogram
27
  server <- function(input, output) {
28
+
29
+ output$distPlot <- renderPlot({
30
+ # generate bins based on input$bins from ui.R
31
+ x <- faithful[, 2]
32
+ bins <- seq(min(x), max(x), length.out = input$bins + 1)
33
+
34
+ # draw the histogram with the specified number of bins
35
+ hist(x, breaks = bins, col = 'darkgray', border = 'white')
36
+ })
37
  }
38
 
39
  shinyApp(ui = ui, server = server)
euler/server.R DELETED
@@ -1,20 +0,0 @@
1
- library(shiny)
2
- library(Rmpfr)
3
-
4
-
5
- shinyServer(function(input, output){
6
-
7
-
8
- output$result <- renderText({
9
-
10
- precisionBits <- input$precision
11
- one <- mpfr(1, precBits = precisionBits)
12
- e <- exp(one)
13
- # TODO fix printing...
14
- x <- capture.output(print(e, ndigits = precisionBits))[2]
15
- gsub("^\\[1\\] (.+)$", "\\1", x)
16
-
17
-
18
- })
19
-
20
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
euler/ui.R DELETED
@@ -1,19 +0,0 @@
1
- library(shiny)
2
-
3
- shinyUI(
4
- fluidPage(
5
- titlePanel("Euler's e in arbitrary precision", "Euler's e"),
6
- tags$br(),
7
-
8
- fluidRow(
9
- column(2, sliderInput("precision", "Number of Precision Bits", min = 2, max = 256,
10
- value = 10))
11
- ),
12
- fluidRow(
13
- column(12, tags$h1(textOutput("result")))
14
-
15
- ),
16
- tags$br(),
17
- tags$p("We would like to acknowledge Leonhard Euler for his number and Martin Maechler for his Rmpfr package.")
18
- )
19
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
shiny-server.conf DELETED
@@ -1,21 +0,0 @@
1
- # Instruct Shiny Server to run applications as the user "shiny"
2
- run_as user;
3
-
4
- # Define a server that listens on port 3838
5
- server {
6
- listen 3838;
7
-
8
- # Define a location at the base URL
9
- location / {
10
-
11
- # Host the directory of Shiny Apps stored in this directory
12
- site_dir /srv/shiny-server;
13
-
14
- # Log all Shiny output to files in this directory
15
- log_dir /var/log/shiny-server;
16
-
17
- # When a user visits the base URL rather than a particular application,
18
- # an index of the applications available in this directory will be shown.
19
- directory_index on;
20
- }
21
- }