Embedding Image in Shiny App

I found another option that looks good for this app, so I’m sharing for others who want the image in the mainPanel. mainPanel( img(src=”https://stackoverflow.com/questions/21996887/myImage.png”, align = “right”), ### the rest of your code ) Save the file in a www directory in the shinyApp directory: | shinyApp/ | ui.R | server.R | www/ | myImage.png

Outputting multiple lines of text with renderText() in R shiny

You can use renderUI and htmlOutput instead of renderText and textOutput. require(shiny) runApp(list(ui = pageWithSidebar( headerPanel(“censusVis”), sidebarPanel( helpText(“Create demographic maps with information from the 2010 US Census.”), selectInput(“var”, label = “Choose a variable to display”, choices = c(“Percent White”, “Percent Black”, “Percent Hispanic”, “Percent Asian”), selected = “Percent White”), sliderInput(“range”, label = “Range of interest:”, … Read more

shiny 4 small textInput boxes side-by-side

to paraphrase (and to simplify to the case of 2 inputs), your problem is that: runApp(list( ui = bootstrapPage( textInput(inputId=”xlimitsmin”, label=”x-min”, value = 0.0), textInput(inputId=”xlimitsmax”, label=”x-max”, value = 0.5) ), server = function(input, output) {} )) shows But you want side-by-side small inputs, like so: The short answer textInputRow<-function (inputId, label, value = “”) { … Read more

R Shiny: reactiveValues vs reactive

There is a catch, though it won’t come into play in your example. The shiny developers designed reactive() to be lazy, meaning that the expression contained in it will only be executed when it is called by one of its dependents. When one of its reactive dependencies is changed, it clears its cache and notifies … Read more

R shiny passing reactive to selectInput choices

You need to use renderUI on the server side for dynamic UIs. Here is a minimal example. Note that the second drop-down menu is reactive and adjusts to the dataset you choose in the first one. The code should be self-explanatory if you have dealt with shiny before. runApp(list( ui = bootstrapPage( selectInput(‘dataset’, ‘Choose Dataset’, … Read more

How to listen for more than one event expression within a Shiny eventReactive handler

I know this is old, but I had the same question. I finally figured it out. You include an expression in braces and simply list the events / reactive objects. My (unsubstantiated) guess is that shiny simply performs the same reactive pointer analysis to this expression block as to a standard reactive block. observeEvent({ input$spec_button … Read more

Shiny: what is the difference between observeEvent and eventReactive?

It’s like the difference between observe and reactive. One is intended to be run when some reactive variable is “triggered” and is meant to have side effects (observeEvent), and the other returns a reactive value and is meant to be used as a variable (eventReactive). Even in the documentation for those functions, the former is … Read more

How to save plots that are made in a shiny app

Not sure if this question is still active but it’s the first one that came up when searching for “saving plots in shiny app” so I wanted to quickly add how to get ggsave to work with downloadHandler along the lines of the original question. The alternative strategies suggested by juba using direct output instead … Read more