Remove a column from a DT::datatable() after DT::formatStyle()

I have a datatable displayed in a shiny app. I would like to highlight certain rows of the data based on a factor column, but I don't want to display that column. However, I can't figure out how to drop the column after I have used it to apply conditional styling.

For example, this code does the highlighting I want, but then I would like to drop the Species column:

iris %>% 
  group_by(Species) %>%
  slice(1) %>% 
  datatable() %>% 
  DT::formatStyle(columns = 'Species',
                            target = 'row',
                            backgroundColor = styleEqual(c('setosa'), 
                                                         c('lightgoldenrodyellow')))

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