Hi,
I am working with R Shiny App and interested in extracting features with values passing a certain threshold. For instance; extracting only features passing the threshold that is value >= 5000 or >= 10000, etc., across all columns. I have shown an example app.R shiny script, and adding the filter in the server doesn't help. Is there a way to revise the below script and make it interactive? This would be helpful
library(shiny)
library(DT)
Data <- structure(list(Col1_Counts = c(100L, 10L, 2000L, 0L, 2000L, 0L,
11L, 15L, 19L, 0L, 100L, 50L, 10L, 100L, 50L), CSC1_Counts = c(150L,
50L, 150L, 3L, 50L, 0L, 12L, 16L, 20L, 23L, 1000L, 50L, 10L,
50L, 50L), BC_Counts = c(50L, 75L, 100L, 10L, 75L, 0L, 13L, 17L,
21L, 0L, 100000L, 40L, 10L, 100000L, 50L)), class = "data.frame", row.names = c("Feature_1",
"Feature_2", "Feature_3", "Feature_4", "Feature_5", "Feature_6",
"Feature_7", "Feature_8", "Feature_9", "Feature_10", "Feature_11",
"Feature_12", "Feature_13", "Feature_14", "Feature_15"))
ui <- fluidPage(
actionButton("go", "Filter Read Counts"),
numericInput("n", "Counts", 5000),
conditionalPanel(
'input.dataset === "Data"',
helpText("Data - test")
),
mainPanel(
tabsetPanel(
id = 'dataset',
tabPanel("Data", DT::dataTableOutput("mytable1"))
)
)
)
server <- function(input, output) {
randomVals <- eventReactive(input$go, {
runif(input$n)
})
output$mytable1 <- DT::renderDataTable({
DT::datatable(Data, options = list(orderClasses = TRUE))
})
}
shinyApp(ui, server)
To filter data:
Data %>%
filter(if_all(everything(), ~ . >= 5000))
Thank you,
Toufiq