I am a beginner in Shiny, and I would like to use values from numeric inputs included in a data table, to update other fields from the same data table.
At this step, it works when the numeric inputs are outside the table, but not when they are included in it. Here is a very simplified version of what I tried, which doesn't work:
Server.R
library(DT)
server.fun <- function(input, output) {
vect_res<- reactive({
value<-NULL
sapply(1:10, FUN = function(i) {
value[i] <<- eval(parse(text=(paste("input$Item",i, sep = "."))))
})
return(value)
}
)
output$results <- renderDataTable({
results <- data.frame(ID=1:10, contents=letters[1:10])
test=NULL
sapply(1:10, FUN = function(i) {
test[i] <<-as.character(numericInput(paste("Item",i, sep = "."),"", value = 1,step=0.1)
)
})
results$test<-test
results$value<-vect_res()
datatable(results, escape=FALSE)
})
}
ui.R
library(DT)
shinyUI({
basicPage(
dataTableOutput( "results" )
)
})
This results in only 3 columns. The numeric inputs are indeed included in the table, but I would expect a 4th column, which would contain the values entered in the numeric inputs.