Table is not shown on shiny app

I want to build simple R shiny app, which gets inputs for data filtering and then render this table.
I write following code:

library(ggplot2)
library(shiny)

## Help Function ####
setwd("C:/Users/lgafrindashvili/Desktop/my files/df_new_pd_25_!2/my_vars")
scores <- read_csv('score.csv')
crt_df <- function(df, set1, product, start = '2021/01', risk_group=-1, th1 = 460, th2 = 500, th3=530, th4=570){
    d = df %>% filter(set == set1 & PERIOD >= start & flg == product & RISK_GROUP >= risk_group) %>%
        mutate(
            cutt_off = case_when(
                SCORE <= th1 ~ 'G1',
                SCORE > th1 & SCORE <= th2 ~ 'G2',
                SCORE > th2 & SCORE <= th3 ~ 'G3',
                SCORE > th3 & SCORE <= th4 ~ 'G4',
                T ~ 'G5'
            )
        )
    d %>% group_by(RISK_GROUP, cutt_off) %>%
        summarise(FR = mean(Target)) %>%
        pivot_wider(names_from = RISK_GROUP, values_from = FR) %>%
        modify_if(is.numeric, percent)
}


## Apps ####

ui <- fluidPage(

tabsetPanel(
    tabPanel(
        h3("Reserve Analysis"),
        fluidRow(
            column(4,
                   h4("Parameters"),
                   selectInput("set2", "choose Set", choices = c('train','test','oot','valid')),
                   selectInput("product", "choose Product", choices = c('CNS','POS')),
                   selectInput("period", "choose start date", unique(scores$PERIOD)),
                   numericInput("risk_group", "choose Risk Group", -1, max = 9, min = -1),
                   numericInput("thr1", "choose threshold_1", 460, max = 1000, min = 0),
                   numericInput("thr2", "choose threshold_2", 500, max = 1000, min = 0),
                   numericInput("thr3", "choose threshold_3", 530, max = 1000, min = 0),
                   numericInput("thr4", "choose threshold_4", 570, max = 1000, min = 0)
            ),
            column(8,
                   h4("Fraud Rate"),
                   tableOutput("table")
            )
         )
        )
    )
)



server <- function(input, output, session) {
    # migration table
    my_table <- reactive({
        crt_df(scores, input$set2, input$product, input$period, input$risk_group, input$thr1, input$thr2, input$thr3, input$thr4)
    })
    output$table = function()my_table()
}


# Run the application
shinyApp(ui = ui, server = server)

input bars are displayed, but table is not shown.
How can I handle this problem?

I don't have the data to test this, but try including renderTable in the assignment of output$table

output$table = renderTable(my_table())

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.