Skip to content

Progress Bar for XPT #730

@muschellij2

Description

@muschellij2

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions