I have a dataframe df1, and subset it to df1sub and display it in an R shiny renderPlot() call. Similarly, I have df2, and I subset it to df2sub, and render it in R shiny via a separate renderPlot() call. Btw these subsets are created based on user choices in an R Shiny app.
Now, I have a datatable that I want to change to reflect whatever the current dataset is, so I wanted some kind of global like:
buffers[1] <- df1sub
buffers[2] <- df2sub
How would I go about defining this global var? I tried separately doing buffers = array() to initialize a global var but then the assignments as I wrote them above don't work?
Update: attempts to use the the '<<-' operator as suggested below yields the following:
buffers <- NULL #don't know how else to initialize. array() yields same error as below.
buffers[1] <<- df # Error in buffers[1] <<- df : object 'buffers' not found