Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress Bar for XPT #730

Open
muschellij2 opened this issue Aug 15, 2023 · 1 comment
Open

Progress Bar for XPT #730

muschellij2 opened this issue Aug 15, 2023 · 1 comment
Labels
feature a feature request or enhancement

Comments

@muschellij2
Copy link

Is it possible to have a progress bar for reading in files, specifically SAS XPORT files?

Here's an example of reading in a small file (6Mb) and everything works fine, but it'd be helpful, if possible, to have a progress bar for larger files (such as https://wwwn.cdc.gov/Nchs/Nhanes/2011-2012/PAXMIN_G.XPT, which is 7.6Gb).

library(haven)
library(curl)
#> Using libcurl 7.79.1 with LibreSSL/3.3.6
xpt = tempfile(fileext = ".xpt")
curl::curl_download("https://wwwn.cdc.gov/Nchs/Nhanes/2011-2012/PAXDAY_G.XPT",
                    destfile = xpt)
haven::read_xpt(xpt)
#> # A tibble: 61,168 × 15
#>     SEQN PAXDAYD PAXDAYWD PAXSSNDP PAXMSTD    PAXTMD PAXAISMD PAXVMD PAXMTSD
#>    <dbl> <chr>   <chr>       <dbl> <chr>       <dbl>    <dbl>  <dbl>   <dbl>
#>  1 62161 1       7               0 "12:30:00"    690  1426946    690  4636. 
#>  2 62161 2       1         3312000 " 0:00:00"   1440  3123802   1440 12531. 
#>  3 62161 3       2        10224000 " 0:00:00"   1440  2779464   1440 14013. 
#>  4 62161 4       3        17136000 " 0:00:00"   1440  2724602   1440 16982. 
#>  5 62161 5       4        24048000 " 0:00:00"   1440  3144826   1440 11718. 
#>  6 62161 6       5        30960000 " 0:00:00"   1440  3001421   1440 16185. 
#>  7 62161 7       6        37872000 " 0:00:00"   1440  4079193   1440  7734. 
#>  8 62161 8       7        44784000 " 0:00:00"   1440  2798564   1440 12479. 
#>  9 62161 9       1        51696000 " 0:00:00"    760  3463791    760    44.8
#> 10 62163 1       7               0 "17:30:00"    390    33043    390  6106. 
#> # ℹ 61,158 more rows
#> # ℹ 6 more variables: PAXWWMD <dbl>, PAXSWMD <dbl>, PAXNWMD <dbl>,
#> #   PAXUMD <dbl>, PAXLXSD <dbl>, PAXQFD <dbl>

Created on 2023-08-15 with reprex v2.0.2

@gorcha gorcha added the feature a feature request or enhancement label Aug 28, 2023
@gorcha
Copy link
Member

gorcha commented Aug 28, 2023

Hi @muschellij2, thanks for the feature request.

Adding progress bars is a bit of work since it would require call backs from the readstat code so I'm unlikely to look at this at least in the short term. I'll keep this issue open in case the opportunity presents itself though, and always happy to review a PR 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants