I am challenged with the various operations associated with rhandsontables, though they seem invaluable to the app I am trying to create. My first challenge is that I am trying to update the rhandsontable by filtering the original dataframe from user input, as selected from a dropdown (selectInput).
Here is a simplified reproducible example, that gets me the results I want, but not through the means I wish:
library(shiny)
library(rhandsontable)
library(tidyverse)
counties = as.factor(c(rep("County1", 2), rep("County2", 2)))
compnames = as.factor(c("comp1", "comp2", "comp3", "comp4"))
properties = 1:4
soilsData <- data.frame(county = counties, compname = compnames, property = properties)
ui <- fluidPage(
selectInput(inputId = "selectCounty", label = h4("Select County"),
choices = counties,
selected = "County1",
multiple = FALSE),
br(),
br(),
rHandsontableOutput('rTable'),
)
server <- function(input, output) {
df1 <- df %>%
filter(county == "County1", compname == "comp1")
datavalues <- reactiveValues(data = df1)
output$rTable <- renderRHandsontable ({
rhandsontable(datavalues$data,
rowHeaders = NULL)
})
}
How do I create that df1 through the selected sliderInput?