Interactive tables with seeking and sorting can be a pleasant way of discovering facts. And often, you might want to share that facts with other people — including text-only facts like a listing of Do Additional With R online video tutorials.

But when that facts incorporates a column with pretty extended entries, that column may possibly not suit effectively in a desk the width of your display. This can be specifically tough when not every row incorporates the extremely-vast column. For illustration, a desk of questionnaire results exactly where 1 area is “Do you have any further comments?” Not anyone may possibly.

Which is exactly where a desk with expandable rows can arrive in helpful. At the NICAR facts journalism meeting previously this calendar year, I posted a variety so speakers (and other attendees) could post inbound links to session shows. Some people added further comments others did not. Showing that column by default would waste a whole lot of display true estate.

As a substitute, that remark area displays in my interactive desk of NICAR resources only if a user clicks on the expand-row icon. Not every row can be expanded with a clickable icon at the left of the Subject matter identify simply because not every row has facts in that area, as you can (with any luck ,) see in the screenshot beneath.

table with expandable rows Sharon Machlis, IDG

R-generated desk with some rows that are expandable to screen additional facts. 

Let’s see how to make a desk like this. 

If you’d like to stick to alongside, set up and load the reactable package deal. For this demo, you are going to also need the rio, glue, htmltools, and dplyr offers put in.

You can obtain the facts I’ll use in this demo from the hyperlink beneath. It’s a tiny (fifteen rows) facts established about R and Python classes at this year’s NICAR meeting.

Copyright © 2020 IDG Communications, Inc.