I'm using Shiny to develop a small app.
My problem of the day is to insert inputs from the user (reactive environment) into an existing dataframe. Specifically, I can't convert the inputs type from closure to double (see error message below).
I've already tried several approaches and googled the problem but didn't find any solution.
Thanks a lot,
Here's a simplified version of the code:
library(shiny)
ui <- fluidPage(
navbarPage(title = "App Title",
tabPanel("Panel Header",
titlePanel("Panel Title"),
sidebarLayout(
sidebarPanel("SideBar"),
mainPanel(
numericInput("User_1","Input1", value = 1, min=0),
numericInput("User_2","Input2", value = 0.3, min=0),
actionButton(inputId = "UserValid",label = "Click me"),
dataTableOutput("df")
)#end mainPanel
)#end sidebarLayout
)#end tabPanel
)#end Navbarpage
)#end ui
server <- function(input, output) {
DB1 <- read.csv2("~/FilePathway/DB1.csv", row.names = 1, sep=",", dec=".")
UserData <- eventReactive(input$UserValid,{
data.frame(U_1 = input$User_1,
U_2 = input$User_2
)})
DB1[66,1:2] <- eventReactive(input$UserValid,{
UserData()
})
}#end server
shinyApp(ui = ui, server = server)
Here's the error message
Warning: Error in <-: incompatible types (from closure to double) in subassignment type fix
52: [<-.data.frame
50: server [#27]
Error in x[[jj]][iseq] <- vjj :
incompatible types (from closure to double) in subassignment type fix
If you have the same issue, please go to this topic for a partial (at least for now) solution: ShinyR : Unexpected result when exporting inputs