By default, all downloads are cached both on the disk and in your computer memory. This means that the second time you download a file during the same session it will be reloaded from your ram. If you stop a session and restart it, the file will be loaded from your disk. If you want to reload the data from its original source, use the bust_cache function.
Arguments
- url
The URL to download from.
- ...
arguments to forward to the vroom::vroom function.
- use_memory
Whether to use memory caching.
- use_disk
Whether to use disk caching.
- bust_cache
Whether to bust (refresh) the cache.
Examples
cache_download("https://s3.amazonaws.com/quartzdata/datasets/caserates-by-age.csv")
#> # A tibble: 132 × 11
#> `0 - 4` `5 - 11` `12 - 15` `16 - 17` 18 - 2…¹ 30 - …² 40 - …³ 50 - …⁴ 65 - …⁵
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 29.2 28.7 41.9 77.3 169. 130. 116. 90.5 60.1
#> 2 98.0 205. 160. 162. 160. 183. 163. 132. 103.
#> 3 13.6 13.9 21.1 31.2 60.5 63.4 64.8 54.6 39.5
#> 4 172. 305. 333. 350. 299. 317. 281. 218. 173.
#> 5 37.7 40.1 65.7 114. 182. 150. 143. 115. 80.5
#> 6 5.63 4.19 7.20 13.3 45.7 64.5 76.8 81.7 68.3
#> 7 27.5 37.3 47.9 61.6 81.1 77.3 65.4 47.7 32.7
#> 8 0.209 0.221 0.323 0.579 1.43 2.44 3.30 4.04 3.79
#> 9 35.5 43.8 44.4 50.3 68.3 66.5 59.0 50.2 44.1
#> 10 16.1 18.0 25.2 31.6 39.8 39.0 34.1 27.1 18.0
#> # … with 122 more rows, 2 more variables: `75+` <dbl>, week <date>, and
#> # abbreviated variable names ¹`18 - 29`, ²`30 - 39`, ³`40 - 49`, ⁴`50 - 64`,
#> # ⁵`65 - 74`
options("tidyiddr_use_cache" = TRUE)
cache_download("https://s3.amazonaws.com/quartzdata/datasets/caserates-by-age.csv")
#> Rows: 132 Columns: 11
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (10): 0 - 4, 5 - 11, 12 - 15, 16 - 17, 18 - 29, 30 - 39, 40 - 49, 50 - ...
#> date (1): week
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 132 × 11
#> `0 - 4` `5 - 11` `12 - 15` `16 - 17` 18 - 2…¹ 30 - …² 40 - …³ 50 - …⁴ 65 - …⁵
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 29.2 28.7 41.9 77.3 169. 130. 116. 90.5 60.1
#> 2 98.0 205. 160. 162. 160. 183. 163. 132. 103.
#> 3 13.6 13.9 21.1 31.2 60.5 63.4 64.8 54.6 39.5
#> 4 172. 305. 333. 350. 299. 317. 281. 218. 173.
#> 5 37.7 40.1 65.7 114. 182. 150. 143. 115. 80.5
#> 6 5.63 4.19 7.20 13.3 45.7 64.5 76.8 81.7 68.3
#> 7 27.5 37.3 47.9 61.6 81.1 77.3 65.4 47.7 32.7
#> 8 0.209 0.221 0.323 0.579 1.43 2.44 3.30 4.04 3.79
#> 9 35.5 43.8 44.4 50.3 68.3 66.5 59.0 50.2 44.1
#> 10 16.1 18.0 25.2 31.6 39.8 39.0 34.1 27.1 18.0
#> # … with 122 more rows, 2 more variables: `75+` <dbl>, week <date>, and
#> # abbreviated variable names ¹`18 - 29`, ²`30 - 39`, ³`40 - 49`, ⁴`50 - 64`,
#> # ⁵`65 - 74`