I'm trying get value of variable "corpus" outside reactive function. I'm creating Shiny app where it is mandatory to define readcsv <- read.csv(inFile$datapath) inside reactive function. Can anybody please help how I can get the dataframe value of corpus outside reactive function data1().
server.R
data1 <- reactive({
inFile <- input$file1
if (is.null(inFile)){
return(NULL)
}
#Read csv file
readcsv <- read.csv(inFile$datapath)
#Create Corpus
corpus <- Corpus(VectorSource(readcsv$Tweets))
})
ui.R
fileInput("file1", "Choose CSV File",
accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv")
)
The following will put the output of
Corpus(...)
indata1
Then you can use it anywhere in
server
like so