Error in filtering sample in Shiny

...I have a dataframe consist of 100 samples. There are three column, one url link, second a name or a heading to the url link and third date. I want to display all those headings in shiny interface. Clicking which leads the user to the respective link page.
Filter samples through selected date. But I am getting a error
Error in UseMethod: no applicable method for 'filter_' applied to an object of class "c('datatables', 'htmlwidget')" Please help

df$link <- paste0("<a href='", df$url, "' target='_blank'>", df$heading, "</a>")

ui <- fluidPage( dateRangeInput('dateRange',
                                label = 'Filter news by date',
                                start = as.Date('2001-01-01') , end = as.Date('2018-06-01')),
  DT::dataTableOutput("table")
   )

server <- function(input, output) {
  
  output$table <- DT::renderDataTable({
    DT::datatable(df[, c("link", "Date"), drop = FALSE], escape = FALSE) %>%
     dplyr::filter(df$Date >= input$dateRange[1] & df$Date <= input$dateRange[2])
  })
  
}

Almost there, you just need to change the ordering of filter. Here's a reproducible example that does not depend on shiny:

library(dplyr)
DT::datatable(mtcars) %>% filter(cyl == 6)
#> Error in UseMethod("filter_"): no applicable method for 'filter_' applied to an object of class "c('datatables', 'htmlwidget')"

Instead, try filtering first and then sending it to a datatable:

library(dplyr)
mtcars %>%
  filter(cyl == 6) %>%
  DT::datatable()
2 Likes