Shiny

R Shiny - Is it possible to nest reactive functions?

倖福魔咒の 提交于 2021-02-11 12:40:25
问题 In R-Shiny. Trying to break up a really long reactive function (thousands of lines!). Hypothetically, is it possible to nest conditional reactive functions, something similar to: STATE_filter <- reactive({ if(input$selectcounty ends with "-AL") { run AL_filter() } else if (input$selectstate ends with "-AR"){ run AR_filter() } else { return("ERROR") } }) EDIT Non-hypothetically, I'm trying to create a nested reactive filtering function based on user select inputs of U.S. counties. Upon their

R Shiny - Is it possible to nest reactive functions?

不打扰是莪最后的温柔 提交于 2021-02-11 12:40:23
问题 In R-Shiny. Trying to break up a really long reactive function (thousands of lines!). Hypothetically, is it possible to nest conditional reactive functions, something similar to: STATE_filter <- reactive({ if(input$selectcounty ends with "-AL") { run AL_filter() } else if (input$selectstate ends with "-AR"){ run AR_filter() } else { return("ERROR") } }) EDIT Non-hypothetically, I'm trying to create a nested reactive filtering function based on user select inputs of U.S. counties. Upon their

Arrange nodes at specific location

末鹿安然 提交于 2021-02-11 12:40:14
问题 In the following vis-network I have 2 groups of nodes. I have separated the 2 groups of nodes into left and right side by accessing the node positions after generating a layput_as_tree . Then using visEvents drew an ellipse around the node groups to show the separation more defined as 2 cell structures. I would like to control the arrangement of the node positions. For example, some nodes need to be on the boundary of the ellipse, some at very center and some scattered around. Wondering if

Arrange nodes at specific location

℡╲_俬逩灬. 提交于 2021-02-11 12:39:45
问题 In the following vis-network I have 2 groups of nodes. I have separated the 2 groups of nodes into left and right side by accessing the node positions after generating a layput_as_tree . Then using visEvents drew an ellipse around the node groups to show the separation more defined as 2 cell structures. I would like to control the arrangement of the node positions. For example, some nodes need to be on the boundary of the ellipse, some at very center and some scattered around. Wondering if

R shiny: insertUI and observeEvent in module

心不动则不痛 提交于 2021-02-11 12:32:23
问题 Using the diamonds dataset as an example, after a button is pressed, two pickerInput should appear. In the first one, the user chooses between three columns of the diamonds dataset. Once a value is selected the app should update the choices of the second pickertInput based on the unique values of the selected column. The app works well without modularizing it. After reading couple of discussions about modules, I still don't clearly understand how to properly declare reactive values for

Embed column with mixed numericInput and selectInput in DT

冷暖自知 提交于 2021-02-11 12:29:27
问题 I would like to add a column to a DT that accepts either selectInput or numericInput, depending on the variable. For example, given the following DF: df1 <- tibble( var1 = sample(letters[1:3],10,replace = T), var2 = runif(10, 0, 2), id=paste0("id",seq(1,10,1)) ) DF=gather(df1, "var", "value", -id) I would like to create an extra col in the DF (using DT ), with selectInput for var1 (choices= letters[1:3]) and numericInput for var2 . I have found here a great example for implementing

Understanding why action buttons in Shiny don't work, when using several of them

邮差的信 提交于 2021-02-11 12:23:32
问题 Why when I put together several action button codes from Shiny manual (https://shiny.rstudio.com/articles/action-buttons.html), it DOES NOT run (i.e. no button reacts) ? Each code separately runs fine. How to fix it? (This is relates to this post: Convert Shiny App R code to Rmarkdown Shiny App code: with observeEvent and eventReactive) # Code from https://shiny.rstudio.com/articles/action-buttons.html library(shiny) ui <- fluidPage( # Pattern 1 - Command tags$head(tags$script(src = "message

Dealing with nested selectizeInputs and modules

99封情书 提交于 2021-02-11 11:26:03
问题 I am having trouble with nested selectizeInputs, i.e. a group of select inputs where the selection in the first determines the choices in the second, which control the choices in the third, and so on. Let's say I have an select1 that lets you choose a dataset, and select2 which lets you pick a variable in the dataset. Obviously the choices in select2 depend on the selection in select1. I find that if a user selects a variable from select2, and then changes select1, it doesn't immediately wipe

Searching Columns in R shiny Datatable that has Multiple Entries

老子叫甜甜 提交于 2021-02-11 11:24:16
问题 I have a datatable in R Shiny, and one of the columns, Keywords, contains multiple entries for some rows, separated by a comma. I would like these multiple entries to be individually searchable. The default search feature for datatable treats these entries as one, long, single item. For example, row 2's value for the column Keywords is "Keyword1, Keyword2". I would like the user to be able to search for either "Keyword1" OR "Keyword2" and find row 2. Currently, the default search bar in

Get min max of sliderInput in shiny

浪尽此生 提交于 2021-02-11 07:32:35
问题 I have a sliderInput element in my ui.R for which I determine the min and the max value dynamically (actually I use a module, where the values are determined from a data set). What I would like to do now is to read the min/max values in my server.R . Of course I could use the same code and determine min/max again, but I was wondering whether it is not possible to get the min/max values from the element directly? 回答1: As a workaround, you could set up reactives to calculate min and max , and