Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
shiny-k8s-example
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hub
shiny-k8s-example
Merge requests
!2
cleanup up main to have a common base to R and python
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
cleanup up main to have a common base to R and python
main-cleanup
into
main
Overview
0
Commits
1
Pipelines
1
Changes
8
Merged
Bryan BRANCOTTE
requested to merge
main-cleanup
into
main
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
8
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
ea5c11a0
1 commit,
1 year ago
8 files
+
4
−
209
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
example_proj/app.R deleted
100644 → 0
+
0
−
83
Options
# Name : app.R
# Folder : ~/rshiny-k8s/example_proj
# Date : 05/04/23
# Aim : Simple example of app developped in RShiny.
# Authors : From Shiny Examples - Modify by Elodie C. et Bryan B.
# Load packages -------------------------------------------------------------------
library
(
shiny
)
library
(
shinythemes
)
library
(
ggplot2
)
### Try to fix error "unable to open connection to X11"
options
(
bitmapType
=
'cairo'
)
# Show installed and loaded packages
sessionInfo
()
# UI part -------------------------------------------------------------------------
# Define UI for app that draws a histogram ----
ui
<-
fluidPage
(
# App title ----
titlePanel
(
"Hello Shiny in docker image!"
),
# 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"
),
# Output: SessionInfo fecth from server
htmlOutput
(
"mySessionInfo"
)
)
)
)
# Server part -------------------------------------------------------------------------
# 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"
)
})
output
$
mySessionInfo
<-
renderPrint
({
capture.output
(
sessionInfo
())
capture.output
(
capabilities
())
})
}
# Run Shiny app ----------------------------------------------------------------------
shinyApp
(
ui
=
ui
,
server
=
server
)
Loading