Shiny

How to 'save' reactive dataframe as non-reactive in shiny/R

自古美人都是妖i 提交于 2020-01-02 10:33:53
问题 I have a reactive dataframe called meals(). I would like to be able to treat it as a non-reactive dataframe. However, meals2<-as.data.frame(meals()) does not give the expected result. So, I tried meals2=reactive({ as.data.frame(meals()) }) and that does not work either, and I think that would give me another reactive dataframe in meals2(), which is not what I want. I know I am misunderstanding some of the basics here. Does anyone have any pointers? 来源: https://stackoverflow.com/questions

R Shiny leaflet addPolygons (colors are not showing)

萝らか妹 提交于 2020-01-02 09:53:55
问题 I hope you can help me. I have created a choropleth Map with Leaflet. I merged my (dataframe with countries and a random score) and a Shapefile with the Polygon data. So far it is working, however if I implement it in R-Shiny, the map is showing, but with no color. There is also no error showing. Anyone knows why? My code: ui <- fluidPage( leafletOutput("map") ) shinyServer(function(input, output) { output$map <- renderLeaflet({ test_map }) }) global.R tmp <- tempdir() url <- "http://www

R Shiny leaflet addPolygons (colors are not showing)

混江龙づ霸主 提交于 2020-01-02 09:53:18
问题 I hope you can help me. I have created a choropleth Map with Leaflet. I merged my (dataframe with countries and a random score) and a Shapefile with the Polygon data. So far it is working, however if I implement it in R-Shiny, the map is showing, but with no color. There is also no error showing. Anyone knows why? My code: ui <- fluidPage( leafletOutput("map") ) shinyServer(function(input, output) { output$map <- renderLeaflet({ test_map }) }) global.R tmp <- tempdir() url <- "http://www

How to close embedded modalDialog

筅森魡賤 提交于 2020-01-02 09:20:23
问题 I have modalDialog embedded into other modalDialog . When I run modalButton both of them closed. How to close only embedded modalDialog ? Now : Code : library(shiny) shinyApp( ui <- fluidPage( actionButton("one","Press") ), server <- function(input, output,session) { observeEvent(input$one,{ showModal(modalDialog( actionButton("two","Press 2"), footer = tagList( modalButton("Cancel") ))) }) observeEvent(input$two,{ showModal(modalDialog( "OKAY", footer = tagList( modalButton("Cancel") ))) })

How to close embedded modalDialog

安稳与你 提交于 2020-01-02 09:20:13
问题 I have modalDialog embedded into other modalDialog . When I run modalButton both of them closed. How to close only embedded modalDialog ? Now : Code : library(shiny) shinyApp( ui <- fluidPage( actionButton("one","Press") ), server <- function(input, output,session) { observeEvent(input$one,{ showModal(modalDialog( actionButton("two","Press 2"), footer = tagList( modalButton("Cancel") ))) }) observeEvent(input$two,{ showModal(modalDialog( "OKAY", footer = tagList( modalButton("Cancel") ))) })

How to manage my R code in a shiny or shinydashboard app?

你。 提交于 2020-01-02 08:49:23
问题 I have made a shinydashboard app which has now quite an amount of lines of code, and I am wondering if there are ways to split the code into different . R files. I have seen a similar question here, but the answer does not help (especially it says nothing about the code in the server part of the app). For the ui part, I have created functions called header , sidebar , and body , and then I merely write ui <- dashboardPage(header(), sidebar(), body()) It works well, and it still works if the

Change style and position of the message box generated by withProgress()

。_饼干妹妹 提交于 2020-01-02 08:33:31
问题 The withProgress() function can generate a message box indicating the shiny app is running. But the message is at the top-right conner of the browser with a small text size, which makes the message not that eye-catching. So I wonder is there any way that I could change the style and the position of this box, so that the message can be more expressive. Here is a part of my code: output$plot <- renderPlot({ if (input$button){ withProgress( distributionPolygon(data(),unit="years",colors=c("black

Change style and position of the message box generated by withProgress()

别来无恙 提交于 2020-01-02 08:33:28
问题 The withProgress() function can generate a message box indicating the shiny app is running. But the message is at the top-right conner of the browser with a small text size, which makes the message not that eye-catching. So I wonder is there any way that I could change the style and the position of this box, so that the message can be more expressive. Here is a part of my code: output$plot <- renderPlot({ if (input$button){ withProgress( distributionPolygon(data(),unit="years",colors=c("black

Retrieving values from an rhandsontable object (R, R shiny)

冷暖自知 提交于 2020-01-02 08:24:10
问题 I use the (awesome) package rhandsontable that will later be included in an R shiny webpage. The user can click at some places, and I want to know how to retrieve the info on which rows was clicked. Here is an example, (to be copy&paste in an R terminal): library(rhandsontable) ## Create the dataset min = c(1,seq(2,34,by=2)) kmh = c(0,seq(7,23,by=1)) mph = round( kmh / 1.609344, digits=0 ) stop.speed = rep(FALSE, length(min)) DF = data.frame(min, kmh, mph, stop.speed, stringsAsFactors = FALSE

Use reactive expressions in renderPlot and download handler when using own functions

时光怂恿深爱的人放手 提交于 2020-01-02 07:45:09
问题 Use reactive expressions in renderPlot and download handler I have had problems by using reactive expressions both in renderPlot() and in downloadHandler() in shiny applications. I want to do this to reduce maintenance and redundancy in my code. The above issue works with "normal" plot functions like plot, hist, etc. In my application I'm using a more complex function which creates a plot. I have created a simplified version of it helpfunc <- function(mean, sd) { hist(rnorm(1000, mean, sd))