Package 'statcanR'

Title: Client for Statistics Canada's Open Economic Data
Description: An easy connection with R to Statistics Canada's Web Data Service. Open economic data (formerly known as CANSIM tables, now identified by Product IDs (PID)) are accessible as a data frame, directly in the user's R environment. Warin, Le Duc (2019) <doi:10.6084/m9.figshare.10544735>.
Authors: Thierry Warin [aut, cre] , Romain Le Duc [aut]
Maintainer: Thierry Warin <[email protected]>
License: MIT + file LICENSE
Version: 0.2.9000
Built: 2025-02-11 05:13:37 UTC
Source: https://github.com/warint/statcanr

Help Index


statcanR

Description

Easily connect to Statistics Canada's Web Data Service with R. Open economic data (formerly known as CANSIM tables, now identified by Product IDs (PID)) are accessible as a data frame, directly in the user's R environment.

Usage

statcan_data(tableNumber, lang)

Arguments

tableNumber

The table number of the Statistics Canada data table

lang

The language wanted

Details

The statcan_data() function has 2 arguments to fulfill to get data: tableNumber & lang.

The tableNumber argument simply refers to the table number of the Statistics Canada data table a user wants to collect, such as '27-10-0014-01' for the Federal expenditures on science and technology, by socio-economic objectives, as an example.

To get the table number: https://www150.statcan.gc.ca/n1/en/type/data.

The second argument, lang, refers to the language. As Canada is a bilingual country, Statistics Canada displays all the economic data in both languages. Therefore, users can choose to collect satistics data tables in French or English by setting the lang argument with c('fra', 'eng').

Value

The output will be a data table representing the data associated with the chosen table number.

Examples

#mydata <- statcan_data('27-10-0014-01', 'eng')

statcanR download data function

Description

statcanR download data function

Usage

statcan_download_data(tableNumber, lang)

Arguments

tableNumber

The table number of the Statistics Canada data table

lang

The language wanted

Value

The output will be a data table and csv file representing the data associated with the chosen table number.

Examples

mydata <- statcan_data('27-10-0014-01', 'eng')