shiny-reactivity

Can I save the old value of a reactive object when it changes?

偶尔善良 提交于 2020-01-31 07:10:07
问题 Note: After coming up with the answer I reworded the question to make if clearer. Sometimes in a shiny app. I want to make use of a value selected by the user for a widget, as well as the previous value selected for that same widget. This could apply to reactive values derived from user input, where I want the old and the new value. The problem is that if I try to save the value of a widget, then the variable containing that value has to be reactive or it will not update every time the widget

Save and Load user selections based on file selection - RShiny

馋奶兔 提交于 2020-01-06 18:42:09
问题 I am trying to create simple app that acts as a GUI for studying different files having same variables but with different version and content. I am unable to give an app where every time the user opens the app they dont have to enter in their parameters again where they left off. I'd like them to be able to save their parameters and bring them up again when they go back to the app. I am giving my sample code here, however the number of inputs and plots are far more in the actual app. I want

Draw bullets/circles on an Image given image coordinates

耗尽温柔 提交于 2020-01-05 03:46:07
问题 Hi I have a R shiny app displaying an image. I would like to draw a bullets/circles on an image based on image coordinates. The image coordinates are being read from a data frame where I would like to iterate over every row, plot and then remove the coordinates drawn for every iteration. I have something like this now #UI UI <- function(id) { fluidPage( useShinyjs(), fluidRow( column(width=12, box(title='Select', width = NULL, closable = TRUE, actionButton("draw", "draw")) )), fluidRow(width

Store selectInput in a string/character object

怎甘沉沦 提交于 2019-12-24 18:48:16
问题 I want to store the variable in input$var to an object which can be compared to a string on the latter part. For now, I just tried to print it on the screen by storing it to an object value_stored . But it not printing anything*(Error: cannot coerce type 'closure' to vector of type 'character'*). That means it's not storing the value. library(shiny) ui <- fluidPage( titlePanel("censusVis"), sidebarLayout( sidebarPanel( helpText("Create demographic maps with information from the 2010 US Census

How do I make the choices in radioButtons reactive in Shiny?

自闭症网瘾萝莉.ら 提交于 2019-12-24 17:10:59
问题 This is what I have and I think the problem is that the ui.R runs first, so the function progs() isn't defined (or I don't know how to do reactive functions). My error looks like this: Error in lapply(obj, function(val) { : could not find function "progs" and my code looks like this: ui.R library(shiny) progs <- list.files("C:/Users/OIT-Classroom/Desktop/ODP/Report 1/aggregate/") progs <- gsub('.{6}$', '', progs) shinyUI(bootstrapPage( tabsetPanel(id="Reports", tabPanel("Report 1",

Error in Running R Shiny App: Operation not allowed without an active reactive context

独自空忆成欢 提交于 2019-12-24 12:56:27
问题 I am using Shiny and R to visualize my data interactively. I would like to draw an interactive scatter plot of Petal.Width versus Petal.Length in Iris dataset and cluster the points based on k clusters (user input) and p, the percentage of data rows dedicated to the training dataset (user input). I added a hover feature to the scatterplot so that by clicking on each point, the whole dataset for that point will be demonstrated. The output should look like this: # Loading Libraries library

Add option to scroll selected items once done using selectizeInput

旧巷老猫 提交于 2019-12-24 12:23:31
问题 I'm using selectizeInput to have multiple selections for an input. I have also added a "Select All or None" option that automatically selects all options or nonw (there are A LOT of options). However, my issue is that when it selects all, there are so many options that it shows all of them in the selectizeInput box and it makes my page super long and you have to scroll to the bottom to see anything else in my app. Wondering if there's an option that allows you to have a max number of items

Pattern for triggering a series of Shiny actions

我是研究僧i 提交于 2019-12-24 11:15:03
问题 I'm having trouble creating a sequence of events in a Shiny app. I know there are other ways of handling parts of this issue (with JS), and also different Shiny functions I could use to a similar end (e.g. withProgress ), but I'd like to understand how to make this work with reactivity. The flow I hope to achieve is as follows: 1) user clicks action button, which causes A) a time-consuming calculation to begin and B) a simple statement to print to the UI letting the user know the calculation

Shiny: Selecting groups using selectizeInput

我与影子孤独终老i 提交于 2019-12-23 02:53:04
问题 I have this vision where I have a selector and a user can click the group to select all items in that group. For example, please see this When you click input box X2 or X4, I would like for the user to be able to click "Western" to select both California and Washington. Ideally, I would like for the user to be able to select multiple regions, as well as be able to customize their selections (i.e choose "Western" region and look at some data. Then unselect "Washington" to focus on "California"

Shiny: How to initialize empty reactiveValues with an actionButton?

拟墨画扇 提交于 2019-12-12 19:21:42
问题 Background: In my app, I have built a pop-up modal wherein users can define variables/parameters and they're subsequently stored in a reactiveValues() once an actionButton is pressed. This appears to work fine. The problem: I have a separate actionButton which is supposed to clear/empty the reactiveValues that holds the inputs above. Unfortunately, this doesn't seem to work--that is, pressing the button doesn't do anything. Minimally-reproducible code: library(DT) # UI modules sidebarCharts <