Таблица, выполненная с помощью функции reactable, не отображается в приложении R Shiny

#r #shiny

Вопрос:

У меня есть фрейм данных, и я хочу построить таблицу с reactable библиотекой. Если не сделать это в R Shiny, то я получил таблицу, однако в приложении R Shiny ничего не отображается.

Мой df и библиотеки

 library(shiny) library(dplyr) library(reactable)  df_orig lt;- structure(list(product = c("AUDI", "AUDI", "AUDI", "AUDI", "AUDI",  "AUDI", "AUDI", "AUDI", "AUDI", "AUDI", "MB", "MB", "MB", "MB",  "MB", "MB", "MB", "MB", "MB", "MB", "BMW", "BMW", "BMW", "BMW",  "BMW", "BMW", "BMW", "BMW", "BMW", "BMW"), tradedate = structure(c(18918,  18919, 18917, 18918, 18918, 18919, 18919, 18918, 18917, 18919,  18919, 18919, 18920, 18919, 18918, 18919, 18919, 18919, 18918,  18918, 18917, 18917, 18918, 18919, 18918, 18917, 18919, 18918,  18918, 18919), class = "Date"), delivery = structure(c(19417,  19905, 18993, 18962, 19297, 19052, 19113, 19024, 18993, 19327,  19205, 19358, 19144, 19905, 19783, 19024, 19844, 19509, 19783,  18993, 19601, 19052, 18962, 18993, 19174, 19631, 19539, 19174,  19601, 19570), class = "Date"), ABSdiff = c(0, 0, 0.0000499999999999945,  0.0000300000000000022, 0, 0, 0.0000200000000000061, 0.0000299999999999745,  NA, NA, 0.0000350000000000003, 0.0000299999999999745, NA, 0.00000200000000005751,  0.0000350000000000072, 0.0000260000000000815, 0.0000269999999999992,  0.0000499999999999945, 0.0000249999999999417, 0.0000429999999997932,  0.0000310000000000032, 0.0000329999999999497, 0.0000429999999999597,  0.0000150000000000983, 0.0000419999999999865, 0.0000390000000000112,  0.0000179999999999625, 0.000028000000000028, 0.000027999999999917,  0.00000499999999992173), diffpct = c(0, 0, 0.0000524548887956833,  0.000387096774193685, 0, 0, 0.000400000000000067, 0.000106913756236615,  NA, NA, 0.00514705882352939, 0.0000741839762610219, NA, 0.00000320256204977554,  0.000062488841278352, 0.000014661102966107, 0.0000280228334198496,  0.0000756429652042367, 0.0000480676792924406, 0.0000177517235684377,  0.0000541958041958557, 0.0000263032042084888, 0.000147715561662487,  0.0000149745432764803, 0.000141271442986812, 0.000187140115163187,  0.0000344102466067753, 0.0000352956006555161, 0.0000438527799528909,  0.00000952562392830814)), row.names = c(NA, -30L), groups = structure(list( product = c("AUDI", "BMW", "MB"), .rows = structure(list( 1:10, 21:30, 11:20), ptype = integer(0), class = c("vctrs_list_of",  "vctrs_vctr", "list"))), row.names = c(NA, -3L), class = c("tbl_df",  "tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",  "tbl_df", "tbl", "data.frame"))  
  1. Код таблицы, которую я хочу получить
 df lt;- subset(df_orig, tradedate == as.Date("2021-10-19")) dflt;- df %gt;%   group_by(product,tradedate) %gt;%   summarise(  ABSdiff = round(max(ABSdiff, na.rm = TRUE),5),  diffpct = round(max(diffpct, na.rm = TRUE)*100,3)  )   col_groups lt;- as.character(unique(df$tradedate))  df lt;- dcast(setDT(df), product ~ tradedate, value.var = c("ABSdiff", "diffpct"), sum)#fun.aggregate = function(x) max(x))   #Create columns in two rows (1-dat,2-diffs) cols lt;- names(df)[!names(df) %in% c("product")] cols lt;- setNames(cols, cols)   columns lt;- lapply(cols, function(x) colDef(name = if (grepl("^ABSdiff", x)) "ABSdiff" else "diffpct")) #already sorted by date #columns lt;- columns[order(as.Date(sub('.*_', '', names(columns))))] columnGroups lt;- lapply(col_groups, function(x) {  cols lt;- unlist(cols[grepl(x, names(cols))])  colGroup(name = x, columns = unname(cols)) })  #to transform column names (date) for (i in 1:length(columnGroups)) {  columnGroups[[i]]$name lt;- as.character(format(as.Date(columnGroups[[i]]$name, format = "%Y-%m-%d"), format = "%d.%h.%Y"))   }   #######Table with all data in detail part####  #show only cells with the values  df[df == 0|df == Inf|df == -Inf] lt;- NA   #Layer 1 reactable(  df,  columns = columns,  columnGroups = columnGroups)   
  1. Code of a table I want to get in R Shiny
   ui lt;- fluidPage(    # Application title  titlePanel("Day-ahead prices"),    # Sidebar with slider input to select date range  sidebarLayout(  sidebarPanel(      # Add a Slider Input to select date range  #sliderInput  dateRangeInput("Date_range_selector", "Select Date Range",  start = as.Date(Sys.Date()-14,"%Y-%m-%d"),  end = as.Date(Sys.Date(),"%Y-%m-%d"),    min = as.Date("2015-01-01","%Y-%m-%d"),  max = as.Date("2021-12-01","%Y-%m-%d"),  #value=c(as.Date(Sys.Date()-14),as.Date(Sys.Date())),  #format ="%Y-%m-%d"  ),  radioButtons("dist", "Data:",  c("The most recent" = "most_recent",  "Historical" = "historical"))  ),    # plot graphs  mainPanel(tabsetPanel(  tabPanel("Plot",   h3(helpText("Prices")),  plotOutput("plot"),  h3(helpText("Descr.statistics")),  verbatimTextOutput("Descr.stat.price")) ,  tabPanel("Stat",  h3(helpText("Production")),  plotOutput("plotconsprod"),  h3(helpText("Descr.statistics")),  verbatimTextOutput("Descr.stat.consprod"))  )  )  ))     server lt;- function(input, output, session) {    #####TAKE DATASET FOR TABLES RECENT VS HISTORICAL    dflt;-reactive({  if (input$dist == "most_recent"){    df_orig %gt;%  filter(tradedate == as.Date("2021-10-19"))#amp; between(as.Date(Date), input$Date_range_selector[1], input$Date_range_selector[2]))      }else{      df_orig %gt;%  filter(tradedate lt; as.Date("2021-10-19"))#amp; between(as.Date(Date), input$Date_range_selector[1], input$Date_range_selector[2]))    }    })       #####TAKE DATASET FOR TABLES RECENT VS HISTORICAL  #select max values and transform df  dflt;- reactive(df() %gt;%   group_by(product,tradedate) %gt;%   summarise(  ABSdiff = round(max(ABSdiff, na.rm = TRUE),5),  diffpct = round(max(diffpct, na.rm = TRUE)*100,3)  ))  col_groups lt;- reactive(as.character(unique(df()$tradedate)))   df lt;- reactive(dcast(setDT(df()), product ~ tradedate, value.var = c("ABSdiff", "diffpct"), sum)) #fun.aggregate = function(x) max(x))  #Create columns in two rows (1-dat,2-diffs)  cols lt;- reactive(names(df())[!names(df()) %in% c("product")])  cols lt;- reactive(setNames(cols, cols))    columns lt;- reactive(lapply(cols, function(x) colDef(name = if (grepl("^ABSdiff", x)) "ABSdiff" else "diffpct")))      #already sorted by date  #columns lt;- columns[order(as.Date(sub('.*_', '', names(columns))))]  columnGroups lt;- reactive(lapply(col_groups, function(x) {  cols lt;- unlist(cols[grepl(x, names(cols))])  colGroup(name = x, columns = unname(cols))  }))    #to transform column names (date)    columnGroups lt;- reactive(  for (i in 1:length(columnGroups())) {  columnGroups()[[i]]$name lt;- as.character(format(as.Date(columnGroups()[[i]]$name, format = "%Y-%m-%d"), format = "%d.%h.%Y"))  }  )      output$table lt;- renderReactable({  reactable(  df(),#  columns = columns(),columnGroups = columnGroups()  #defaultColDef = colDef(minWidth = 222,vAlign = "center"),  #defaultColDef = colDef(vAlign = "center", headerVAlign = "bottom"),    # Set a maximum width on the table:  #style = list(maxWidth = 650),  # Or a fixed width:  #width = 650,    )  }) }  shinyApp(ui, server)  

Не могли бы вы помочь в поиске ошибки?