Download the zipped file, unzip, rename the unzipped files, and outputs a data frame along with the title from meta data.

gdpimporterr(url, filename = NULL, filetype = "csv")

Arguments

url

A character vector with one element: URL to the zip file (ends with .zip)

filename

A character vector with one element: specify the name of csv data (not the MetaData). If NULL, 'open_canada_data.csv' will be the filename. This argument is not useful when filetype is set to 'all'

filetype

A character vector with one element: the types of files that will be extracted. If 'csv', only csv files are extracted'. If 'all', files of all types are extracted

Value

A list whose first element is a data frame and second element is a character with one element

Examples

gdpimporterr("https://www150.statcan.gc.ca/n1/tbl/csv/36100400-eng.zip")
#> [[1]]
#> # A tibble: 8,255 × 15
#>    REF_DATE GEO      DGUID `North America…` UOM   UOM_ID SCALAR_FACTOR SCALAR_ID
#>       <dbl> <chr>    <chr> <chr>            <chr>  <dbl> <chr>             <dbl>
#>  1     1997 Newfoun… 2016… All industries … Perc…    246 units                 0
#>  2     1997 Newfoun… 2016… Goods-producing… Perc…    246 units                 0
#>  3     1997 Newfoun… 2016… Service-produci… Perc…    246 units                 0
#>  4     1997 Newfoun… 2016… Industrial prod… Perc…    246 units                 0
#>  5     1997 Newfoun… 2016… Information and… Perc…    246 units                 0
#>  6     1997 Newfoun… 2016… Energy sector [… Perc…    246 units                 0
#>  7     1997 Newfoun… 2016… Agriculture, fo… Perc…    246 units                 0
#>  8     1997 Newfoun… 2016… Mining, quarryi… Perc…    246 units                 0
#>  9     1997 Newfoun… 2016… Utilities [22]   Perc…    246 units                 0
#> 10     1997 Newfoun… 2016… Construction [2… Perc…    246 units                 0
#> # … with 8,245 more rows, and 7 more variables: VECTOR <chr>, COORDINATE <dbl>,
#> #   VALUE <dbl>, STATUS <chr>, SYMBOL <lgl>, TERMINATED <lgl>, DECIMALS <dbl>
#> 
#> [[2]]
#> [1] "Gross domestic product (GDP) at basic prices, by industry, provinces and territories, percentage share"
#>