R Reactable hide columns by default

Viewed 746

I would like to display a dataframe consisting on many columns in a reactable. Since only very few columns are interesting the default setting should be to hide the columns. When I do this it is however impossible to see any columns since none are displayed at all. What is the correct way to do this?

library(reactable)
reactable(mtcars,
          defaultColDef = colDef(show = F),
          columns = list(
            mpg = colDef(show =T)
          ))

In this case no columns are displayed despite mpg being set to TRUE.

1 Answers

If you only want to display mpg column, you can simply subset this column in reactable:

reactable(mtcars[0:1],
          defaultColDef = colDef(show = T))
Related