I am falling at the first hurdle when attempting to create a dashboard with shiny.
As the most basic example...if I got to new --> shiny web app... and try to run the template code that appears (copied below), it doesn't work. I get 'Loading required package: shiny' in the console but I believe it should also say 'listening on [url]' which it doesn't.
All in all, nothing happens! Except that something is running and the only way I can get out of it is quit R.
I posted my session/version info at the very bottom.
Any help would be really appreciated!
This is a Shiny web application. You can run the application by clicking
the 'Run App' button above.
Find out more about building applications with Shiny here:
http://shiny.rstudio.com/
library(shiny)
Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
Run the application
shinyApp(ui = ui, server = server)
This is my session/version info:
Show in New Window
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 htmltools_0.5.1.1 tools_4.1.0 yaml_2.2.1 rmarkdown_2.8 knitr_1.33 xfun_0.23
[8] digest_0.6.27 rlang_0.4.11 evaluate_0.14
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 1.0
year 2021
month 05
day 18
svn rev 80317
language R
version.string R version 4.1.0 (2021-05-18)
nickname Camp Pontanezen