gt
gt copied to clipboard
Suggestion: warn user before rendering N rows
Just an idea. I just tried running gt::gt(gt::pizzaplace) in the rstudio console and I thought my RStudio got frozen. I tried it several times, and each time I had to abort the operation. Eventually I realized it just took a full minute to complete the render.
Perhaps it'd be friendly to the user to show a message confirming that the user indeed wants to print the entire table if gt notices that there are above N number of rows? Of course only do this in interactive mode. Or maybe even just showing a message would be enough.
I shot myself in the foot with this probably five times. Seemingly each time I thought there was a system issue and didn't realize it was a huge render.
Basically, this is a good idea. Need to think about the right implementation (but there are lots of case studies for this sort of thing).
I personally like visdat::vis_dat()'s approach, which provides a warning if your data is above a certain size (ncol*nrow > 900000), but you can turn off this warning using the warn_large_data parameter (see here)
Hi @daattali, I didn't realize how slow gt::gt(gt::pizzaplace) was, so thanks even for that feedback alone!
@rich-iannone and I talked about this in person. I'd like to investigate two other paths first:
- It's been a while since we've done an optimization pass on gt, a cursory investigation last week showed that huge gains are easily attainable.
- Showing a progress bar for larger tables/slower renders would convey all of the same information and more. This is assuming that your R session doesn't have any difficulty cancelling a slower render? (Worked fine for us in RStudio when we tried it)
@rich-iannone recently merged a PR that makes this on the order of 10X faster, IIRC. We might still want to do a progress bar, but we're going to move that out of this CRAN release. Thanks!