Shiny

R shiny build links between tabs with DT package

心已入冬 提交于 2021-02-05 05:34:26
问题 Solution for creating links between tabs a have found here R shiny build links between tabs is really nice, but it's not working with DT package (for me..). Can anybody tell me, what am I doing wrong in my example code using DT library in compare to the solution without DT package? library(shiny) library(DT) server <- function(input, output) { output$iris_type <- DT::renderDataTable({ datatable(data.frame(Species=paste0("<a href='#filtered_data'>", unique(iris$Species), "</a>")), escape =

How to get choices values of SelectInput in Shiny?

北城以北 提交于 2021-02-05 00:28:28
问题 How can I get the list of choices in a SelectInpute? ui.R selectInput(inputId = "select_gender", label = "Gender", choices = c("Male","Female"), width = 150 ) server.R # Something like... genders <- input$select_gender["choices"] # So that the gender would be: > genders [1] Male Female 回答1: From the scoping rules of Shiny: Objects defined in global.R are similar to those defined in app.R outside of the server function definition, with one important difference: they are also visible to the

observeEvent in insertUI generated in loop

一曲冷凌霜 提交于 2021-02-04 21:09:55
问题 When I create new objects with insertUI in a reactive way, all the observers that I create work perfectly fine, as you can see in the following dummy code: library(shiny) # Define the UI ui <- fluidPage( actionButton("adder", "Add"), tags$div(id = 'placeholder') ) # Define the server code server <- function(input, output) { rv <- reactiveValues() rv$counter <- 0 observeEvent(input$adder,{ rv$counter <- rv$counter + 1 add <- sprintf("%03d",rv$counter) filterId <- paste0('adder_', add) divId <-

observeEvent in insertUI generated in loop

≡放荡痞女 提交于 2021-02-04 21:09:04
问题 When I create new objects with insertUI in a reactive way, all the observers that I create work perfectly fine, as you can see in the following dummy code: library(shiny) # Define the UI ui <- fluidPage( actionButton("adder", "Add"), tags$div(id = 'placeholder') ) # Define the server code server <- function(input, output) { rv <- reactiveValues() rv$counter <- 0 observeEvent(input$adder,{ rv$counter <- rv$counter + 1 add <- sprintf("%03d",rv$counter) filterId <- paste0('adder_', add) divId <-

R Shiny create several random numbers with button and save it

丶灬走出姿态 提交于 2021-02-04 21:07:48
问题 I want to create a button that generates a random number and save all random numbers on my server that I can evaluate that data later. Unfortunately I am not able to generate a vector with all random numbers. Somehow a for loop is not working. Thanks! library(shiny) ui <- fluidPage( actionButton("button", "Show") ) server <- function(input,output) { eventReactive(input$button, { counter <- sample(1:10,1) }) } shinyApp(server = server, ui = ui) 回答1: You don't need a for loop in R to generate a

Display a Loading Sign while a model is being trained in Shiny App

淺唱寂寞╮ 提交于 2021-02-04 19:11:05
问题 I am making a Shiny App in which, at the click of the actionButton, a model is trained using the caret package. As this training takes time - approximately 4-5 minutes - I wanted to display a loading sign or a loading GIF in the App where results are displayed after the model is trained. Otherwise, the User wouldn't know what is happening or when the model is trained. Thanks 回答1: There is loading spinner which you can use in your ui.R # loading the library library(shinycssloaders) withSpinner

How to edit column names in datatable function when running R shiny app?

橙三吉。 提交于 2021-02-04 16:47:34
问题 I'm using datatable function from DT package in R Shiny and I want that the user of my app can edit the column names (the variable names). Is there any option to do that? For now I'm using a text input "old_var_name", a text input "new_var_name" and an actionbutton "update_variable_name". But at this point, I'm only able to change on variable name at the time. I want the user to be able to change as much as variable names he wants. Server: tab <- eventReactive(input$import,{ inFile <- input

How to edit column names in datatable function when running R shiny app?

一曲冷凌霜 提交于 2021-02-04 16:46:34
问题 I'm using datatable function from DT package in R Shiny and I want that the user of my app can edit the column names (the variable names). Is there any option to do that? For now I'm using a text input "old_var_name", a text input "new_var_name" and an actionbutton "update_variable_name". But at this point, I'm only able to change on variable name at the time. I want the user to be able to change as much as variable names he wants. Server: tab <- eventReactive(input$import,{ inFile <- input

Trying to integrate updateTabsetPanel with leaflet marker click in R Shiny?

梦想与她 提交于 2021-02-04 16:40:49
问题 I was wondering if anyone knew a solution to an issue I'm having in Rshiny. In short, I'm looking to have leaflet-based map markers update the user's current tab. Ideally, my group want users to use the map to navigate between statistics exercises, housed within the tabs (exercises not present in this example). The idea is that certain building markers are relevant to certain tabs, and the user looks at the map, sees markers, clicks to find out more (with popup), and the tab below changes

Shiny (R GUI) replaces < and > with < and > in tags$script

寵の児 提交于 2021-02-04 14:53:25
问题 Shiny (R GUI) replaces < and > with & lt; and & gt; in tags$script(), how to fix that? I need to use greater and less signs in my javascript. 回答1: Whoops, sorry about that! You can work around this problem for now by wrapping your script strings in HTML() , which will tell Shiny not to escape (this works in any context, not just inside script tags). 来源: https://stackoverflow.com/questions/19816551/shiny-r-gui-replaces-and-with-lt-and-gt-in-tagsscript