1

In my shiny app, I have the user input a CSV file using fileInput. When that file is input into my file, I want to create a dataframe df, and create further subsets of this dataframe. How can I create and use the dataframe and subsets in multiple outputs, such as creating multiple plots with the dataframe?

I want to perform the following actions on the imported CSV file and then use the dataframe in subsets in multiple outputs.

How can I use the variables and subset data in multiple outputs?

  • You need to create reactive objects that the output can use to get updated data. It would be easier to help you if you had a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) that could be used for testing that doesn't necessarily involved having a specific CSV file on our computer. – MrFlick Apr 02 '18 at 22:44

1 Answers1

0

maybe you want something like

myDF <- reactive({
df <- read.csv(inFile$datapath, header = TRUE, sep = ",")
# Convert df[1] from Factor to Character
i <- sapply(df, is.factor)
df[i] <- lapply(df[i], as.character)

df[, c(1, 28:29)]
})



  # Extract Depth From df[1]
  readingdepth <- c(word(myDF()[,1],-1))
  readingdepth = as.numeric(readingdepth)


  # Create .5 Foot Marker
  halfdepth <- c(readingdepth + .5)
  well <- c(word(myDF()[,1],1,-2))
Carlos Santillan
  • 1,077
  • 7
  • 8