Spaces:
Runtime error
Runtime error
more
Browse files- .DS_Store +0 -0
- Dockerfile +31 -14
- Rprofile.site +3 -0
- euler/server.R +20 -0
- euler/ui.R +19 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
Dockerfile
CHANGED
@@ -1,19 +1,36 @@
|
|
1 |
-
|
2 |
-
FROM ubuntu:kinetic
|
3 |
|
4 |
-
|
5 |
-
RUN apt-get update \
|
6 |
-
&& DEBIAN_FRONTEND=noninteractive \
|
7 |
-
apt-get install --no-install-recommends --assume-yes \
|
8 |
-
build-essential \
|
9 |
-
python3 \
|
10 |
-
python3-dev \
|
11 |
-
python3-pip
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
-
|
|
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM openanalytics/r-ver:4.1.3
|
|
|
2 |
|
3 |
+
LABEL maintainer="Tobias Verbeke <tobias.verbeke@openanalytics.eu>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
# system libraries of general use
|
6 |
+
RUN apt-get update && apt-get install --no-install-recommends -y \
|
7 |
+
pandoc \
|
8 |
+
pandoc-citeproc \
|
9 |
+
libcurl4-gnutls-dev \
|
10 |
+
libcairo2-dev \
|
11 |
+
libxt-dev \
|
12 |
+
libssl-dev \
|
13 |
+
libssh2-1-dev \
|
14 |
+
libssl1.1 \
|
15 |
+
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
+
# system library dependency for the euler app
|
18 |
+
RUN apt-get update && apt-get install -y \
|
19 |
+
libmpfr-dev \
|
20 |
+
&& rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
+
# basic shiny functionality
|
23 |
+
RUN R -q -e "install.packages(c('shiny', 'rmarkdown'))"
|
24 |
|
25 |
+
# install dependencies of the euler app
|
26 |
+
RUN R -q -e "install.packages('Rmpfr')"
|
27 |
+
|
28 |
+
# copy the app to the image
|
29 |
+
RUN mkdir /root/euler
|
30 |
+
COPY euler /root/euler
|
31 |
+
|
32 |
+
COPY Rprofile.site /usr/local/lib/R/etc/
|
33 |
+
|
34 |
+
EXPOSE 3838
|
35 |
+
|
36 |
+
CMD ["R", "-q", "-e", "shiny::runApp('/root/euler')"]
|
Rprofile.site
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
local({
|
2 |
+
options(shiny.port = 3838, shiny.host = "0.0.0.0")
|
3 |
+
})
|
euler/server.R
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
)
|