column e is editable column of a datatable and column f output is based on column e.and the datatable is the output of a reactive function.
Can you say how f should be based on e? If e is less than 4 then yes, otherwise no?
library(shiny)
library(tidyverse)
library(DT)
some_data <- data.frame(e=1:8)
ui <- DTOutput('tbl')
server <- function(input, output, session) {
some_reactive <- reactive(some_data)
modified_reactive <- reactive({
mutate(some_reactive(),
f=if_else(e<4,"yes","no"))
})
output$tbl <- renderDT( modified_reactive() )
}
shinyApp(ui, server)
e column is an editable column its like input after giving that f should show up
I would use the same logic.
some_reactive could have any content. even content set by your modification/editing.
can u help me with this?
Also 11 8 and 6 add to 25 but you did not include that. But why ?
ya exactly it can give one of the combination but it should be equal to the given input.if there is no exact combination it is fine if its little more than the input
I think this could be an example of naivety vis the mathematical complexity of what is being requested...
Subset sum problem - Wikipedia
What is the largest expected number of rows that might be an input to your program ?
I had a quick look on CRAN and perhaps CRAN - Package mknapsack (r-project.org) might be an option to try.
two or three rows fine
if i give f= sapply(1:5, function(i) {
sprintf('', i)
})
its not working
library(shiny)
library(tidyverse)
library(DT)
some_data <- data.frame(e=1:8)
ui <- DTOutput('tbl')
server <- function(input, output, session) {
some_reactive <- reactive(some_data)
modified_reactive <- reactive({
mutate(some_reactive(),
f=if_else(e<4,"yes","no"))
})
output$tbl <- renderDataTable ( modified_reactive(),
editable = list(target = "row",
disable = list(columns = c(1:ncol(some_reactive())-2))
),
)
}
shinyApp(ui, server)
if im changing the col e f is not changing??
observeEvent(input$modified_function_cell_edit, {
g=if_else(f>100,"yes","no")
})
itried this also seems not working if im using reactive and editable columns are not getting updated with yes or no
The discussion continues on this thread