I'm trying to create a dashboard in Shiny where the user can select a month/year and perform some forecasting analysis on that time period. At this point, I have something that runs and I'm able to bring in a reactive dataset using a fileInput() call. The problem I'm having is subsetting the data by a selected part number. So I bring in the .csv with incidentDate, partNumber, and demand (columns of data) and now I want to subset the data using a selected part number (using textInput as my reactive value).
data <- reactive({
file1 <- input$file
if(is.null(file1)){return()}
f = read.csv(file=file1$datapath, header = TRUE, stringsAsFactors = FALSE)
})
The code above is how I read in the .csv from my computer. That dataset is now a reactive dataset that I can list as a table using data().
output$table <- renderTable({
if(is.null(data())){return()}
"how do I call the f from the above reactive function here?"
})
If I use a textInput box using "part" as my pointer to what the user inputs, how do I subset the data() to only include rows that match that part number? In regular R, I would just call data$partNumber = '7800123489' and it would subset, but I'm not sure how to do it with a reactive dataset that I brought in using Shiny.