statcan_data {statcanR}R Documentation

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')


[Package statcanR version 0.2.6 Index]