Hallo everyone,
I am new to this forum and would like to learn writing shiny UIs. So I have a weird problem and could not find any topic helping me out.
In order to get started, I went to the tutorial here (Shiny - Welcome to Shiny) and followed the instructions. Unfortunately, I cannot replicate the very first examples provided with the package.
For example, if I try to do:
runExample("01_hello")
instead of a windows displaying a slidebar and a histogram, i only get a window with an input field (instead of the slider).
Also, the following Code results into the same:
library(shiny)
# Define UI for app that draws a histogram ----
ui <- fluidPage(
# App title ----
titlePanel("Hello World!"),
# 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)
I clearly can see a sliderbar called in the script above, making this issue even more confusing. Can someone help me out?
sessioninfo():
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.7 shiny_1.3.2
loaded via a namespace (and not attached):
[1] htmlwidgets_1.3 compiler_3.5.1 magrittr_1.5 R6_2.3.0 promises_1.0.1 later_0.8.0
[7] htmltools_0.3.6 tools_3.5.1 yaml_2.2.0 Rcpp_0.12.19 crosstalk_1.0.0 digest_0.6.18
[13] xtable_1.8-3 httpuv_1.5.1 mime_0.6