How to read file from user in Shiny and assign it to a variable in global.r? I want to read a csv file as input from user in Shiny and assign it to a variable in global.r file.The code I have in ui.R is

fileInput('file1', 'Choose CSV File',
                     accept=c('text/csv', 'text/comma-separated-values,text/plain', .csv'))


The code I have in main Panel of server.R is

textOutput('contents')


The code I have currently in server.R is

output$contents &lt;- renderText({    
      if(is.null(input$file1))return()
      inFile &lt;- input$file1
      data&lt;-read.csv(inFile$datapath)
  print(summary(data))

 })


I want to assign this input$file1 to a variable called 'data' in global.r. Please let me know if this is possible. 
Thanks
I have added the following code to global.R file

data &lt;- reactiveValues()


I used assign function in server.R to assign values to data in global.r

output$contents &lt;- renderText({    
      if(is.null(input$file1))return()
      inFile &lt;- input$file1
      data2&lt;-read.csv(inFile$datapath)
  assign('data',data2,envir=.GlobalEnv)
  print(summary(data))
 })