title: R Shiny, how to update variable within observeEvent call
body: <p>I am unable to update a list within an observeEvent call.</p>
  
  <p>The list is called <code>Participants</code> and is a list-of-lists - i.e. a profile for each user. <code>Participants</code> is supposed to be updated by any user on a certain <code>observeEvent</code> call. </p>
  
  <p>I have tried making the variable reactive and also non-reactive, but it does not work. </p>
  
  <p>Below is a minimum working example </p>
  
  <h1>ui.R</h1>
  
  <p>The code for user</p>
  
  <pre><code>library(shiny)
  
  shinyUI( fluidPage(
      sidebarLayout(
          #---------------------------------------------------
          # accept user transid
          sidebarPanel(
              numericInput("transid", "Transid", 0), 
              actionButton("accept", "Accept" )
          ),
          #---------------------------------------------------
          # Return user spreadsheet
          mainPanel( verbatimTextOutput("userSpreadSheet"))
  ))
  )
  </code></pre>
  
  <h1>server.R</h1>
  
  <p>The code for server
      #---------------------------------------------------
      ##################
      # Definitions
      library(shiny)</p>
  
  <pre><code>## Create Participant List
  ParticipantsDF &lt;- data.frame(
      Name=stringi::stri_rand_strings(n=20, length=8, pattern="[a-z]"),
      ID=paste0("JA",1:20) ) 
  spreadsheet  &lt;- list(data.frame(foo=1:10, bar=runif(10), transid=NA) )
  Participants &lt;- apply( ParticipantsDF, 1, function(e){
       c( as.list(e), spreadsheet=spreadsheet ) })
  ParticipantIDs &lt;- ParticipantsDF$ID
  ParticipantNames &lt;- ParticipantsDF$Name
  
  ## Update Participants by changing a person
  ## based on user input of transid value
      ## change persons sublist named ``transid''
  update_person &lt;- function(transid, pid, participants){
      ## Which User
      userProfile_u &lt;- participants[[pid]]
      ## Update User next transid to TRUE
      rows_vacant &lt;- is.na(userProfile_u$spreadsheet$transid)
      row_update &lt;- head( which(rows_vacant),1)
      userProfile_u$spreadsheet[row_update, "transid"] &lt;- TRUE 
      ## Update Participants
      participants[[pid]] &lt;- userProfile_u
      Participants &lt;&lt;- participants
  }
  
  #----------------------------------------------------------------------
  ##################
  # Server 
  server &lt;- function( input, output, session){
  
      #---------------------------------------------------
      # Get authorized user: requires shiny-server-pro
      user &lt;- session$user
  
      #---------------------------------------------------
      # Return user profile
      userPID &lt;- which(ParticipantIDs == session$user )
      userProfile &lt;- Participants[[userPID]]
      #---------------------------------------------------
      # When user clicks ``accept'', update Participants
      observeEvent(input$accept, {
          update_person(
              input$transid,
              userPID,
              Participants
          )
      })
      #---------------------------------------------------
      # Display spreadsheet to user
      ## Does Not Update!
      output$userSpreadSheet &lt;- renderPrint({
          Participants[[userPID]][["spreadsheet"]] })
      ## Updates (Based on Accepted Answer)
      #ReactiveParticipants &lt;- reactiveValues(Participants=Participants)
      #output$userSpreadSheet &lt;- renderPrint({
      #    ReactiveParticipants$Participants[[userPID]][["spreadsheet"]]
      #})
      #observe({  invalidateLater(100)
      #    ReactiveParticipants$Participants &lt;&lt;- Participants
      #})
  }
  shinyServer(server)
  </code></pre>
  
  <p>If I edit the above code not to use renderPrint reactiveValues, then it still does not work. </p>