How to delete element from reactiveValues()
For example, when I run the code:
library(shiny)
runApp(list(
ui=tableOutput("table1"),
server=function(input, output, session) {
values <- reactiveValues(val1 = 1, val2 =2, val3 = 3)
values$val1 <- NULL
output$table1 <- renderPrint(reactiveValuesToList( values) )
}))
The output is:
$val1 NULL $val2 [1] 2 $val3 [1] 3
Instead of:
$val2 [1] 2 $val3 [1] 3
Thank you!
I'll try to addres this:
When you assign NULL to the value R will remove the element from memory. See the app below - when you click
delete
button the memory is released:The two images below show you the state before clicking the
delete
, and after -> note that the value used by R has changed.Those missing 80mb is the size of the
val1
vector.