Ajout fichiers de données
This commit is contained in:
parent
f40ecfa1d2
commit
38d33fb7b6
6 changed files with 140 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -49,3 +49,4 @@ po/*~
|
|||
# RStudio Connect folder
|
||||
rsconnect/
|
||||
|
||||
/.idea/
|
||||
|
|
72
data_extraction_statcan.rmd
Normal file
72
data_extraction_statcan.rmd
Normal file
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
title: "Revenu universel de base avec le retrait de l'exemption fiscale de base"
|
||||
output: html_document
|
||||
---
|
||||
|
||||
## Obtenir les informations pertinentes sur les revenus canadiens depuis Statistiques Canada
|
||||
|
||||
```{r}
|
||||
library(statcanR)
|
||||
library(dplyr)
|
||||
library(stringr)
|
||||
library(readr)
|
||||
```
|
||||
|
||||
```{r}
|
||||
# Population by income group
|
||||
population_by_income_group <- statcanR::statcan_download_data(tableNumber="98-10-0064-01", lang="eng")
|
||||
```
|
||||
Cleaning total income column names
|
||||
|
||||
```{r}
|
||||
names(population_by_income_group) <- c("REF_DATE","GEO","DGUID","AGE","GENDER","TOTAL_INCOME_GROUP", "COORDINATE","Y2020","SYMBOL0","Y2015","SYMBOL","INDICATOR","COORDINATE0")
|
||||
```
|
||||
|
||||
|
||||
Cleaning total income population data
|
||||
|
||||
```{r}
|
||||
population_by_income_group %>%
|
||||
filter(GEO=="Canada",
|
||||
AGE=="Total - Age",
|
||||
GENDER=="Total - Gender") %>%
|
||||
select(REF_DATE,TOTAL_INCOME_GROUP,Y2020,Y2015)->
|
||||
population_by_income_group_filtered
|
||||
```
|
||||
|
||||
|
||||
```{r}
|
||||
# Population by after-tax income group
|
||||
population_by_after_tax_income_group <- statcanR::statcan_download_data(tableNumber="98-10-0065-01", lang="eng")
|
||||
```
|
||||
Cleaning after tax column names
|
||||
|
||||
```{r}
|
||||
names(population_by_after_tax_income_group) <- c("REF_DATE","GEO","DGUID","AGE","GENDER","AFTERTAX_INCOME_GROUP", "COORDINATE","Y2020","SYMBOL0","Y2015","SYMBOL","INDICATOR","COORDINATE0")
|
||||
```
|
||||
|
||||
Cleaning after tax population data
|
||||
|
||||
```{r}
|
||||
population_by_after_tax_income_group %>%
|
||||
filter(GEO=="Canada",
|
||||
AGE=="Total - Age",
|
||||
GENDER=="Total - Gender") %>%
|
||||
select(REF_DATE,AFTERTAX_INCOME_GROUP,Y2020,Y2015)->
|
||||
population_by_after_tax_income_group_filtered
|
||||
```
|
||||
|
||||
Save data to csv file
|
||||
|
||||
```{r}
|
||||
population_by_income_group_filtered %>%
|
||||
write_csv("population_by_income_group_filtered.csv")
|
||||
population_by_after_tax_income_group_filtered %>%
|
||||
write_csv("population_by_after_tax_income_group_filtered.csv")
|
||||
```
|
||||
|
||||
|
||||
```{r}
|
||||
# Tax brackets
|
||||
federal_income_brackets <- read.csv("federal-income-brackets.csv")
|
||||
```
|
6
federal-income-brackets.csv
Normal file
6
federal-income-brackets.csv
Normal file
|
@ -0,0 +1,6 @@
|
|||
lower,upper,percent
|
||||
0,55867,15
|
||||
55867,111733,20.5
|
||||
111733,173205,26
|
||||
173205,246752,29
|
||||
246752,10000000,33
|
|
23
population_by_after_tax_income_group_filtered.csv
Normal file
23
population_by_after_tax_income_group_filtered.csv
Normal file
|
@ -0,0 +1,23 @@
|
|||
REF_DATE,AFTERTAX_INCOME_GROUP,Y2020,Y2015
|
||||
2021-01-01,Total - After-tax income,30336135,28642980
|
||||
2021-01-01,Without after-tax income,1079955,1143795
|
||||
2021-01-01,With after-tax income,29256180,27499185
|
||||
2021-01-01,Percentage with after-tax income,96.4,96
|
||||
2021-01-01,"Under $5,000 (including loss)",1461745,2126645
|
||||
2021-01-01,"$5,000 to $9,999 ",1099950,1578610
|
||||
2021-01-01,"$10,000 to $14,999",1522855,2099155
|
||||
2021-01-01,"$15,000 to $19,999",2085400,2269120
|
||||
2021-01-01,"$20,000 to $24,999",2805875,2373320
|
||||
2021-01-01,"$25,000 to $29,999",2488625,2022355
|
||||
2021-01-01,"$30,000 to $34,999",2293055,1878515
|
||||
2021-01-01,"$35,000 to $39,999",2149915,1833865
|
||||
2021-01-01,"$40,000 to $44,999",2014240,1711765
|
||||
2021-01-01,"$45,000 to $49,999",1784470,1504005
|
||||
2021-01-01,"$50,000 to $54,999",1530410,1286085
|
||||
2021-01-01,"$55,000 to $59,999",1302715,1084450
|
||||
2021-01-01,"$60,000 to $69,999",2020895,1703000
|
||||
2021-01-01,"$70,000 to $79,999",1428515,1210700
|
||||
2021-01-01,"$80,000 to $89,999",1027020,872865
|
||||
2021-01-01,"$90,000 to $99,999",643700,547620
|
||||
2021-01-01,"$100,000 and over",1596795,1397105
|
||||
2021-01-01,Median after-tax income ($),36800,33600
|
|
25
population_by_income_group_filtered.csv
Normal file
25
population_by_income_group_filtered.csv
Normal file
|
@ -0,0 +1,25 @@
|
|||
REF_DATE,TOTAL_INCOME_GROUP,Y2020,Y2015
|
||||
2021-01-01,Total - Total income,30336135,28642980
|
||||
2021-01-01,Without total income,1094320,1154455
|
||||
2021-01-01,With total income,29241810,27488530
|
||||
2021-01-01,Percentage with total income,96.4,96
|
||||
2021-01-01,"Under $5,000 (including loss)",1372840,2046650
|
||||
2021-01-01,"$5,000 to $9,999",1061890,1540875
|
||||
2021-01-01,"$10,000 to $14,999",1482780,2059750
|
||||
2021-01-01,"$15,000 to $19,999",1965405,2148060
|
||||
2021-01-01,"$20,000 to $24,999",2509900,2109215
|
||||
2021-01-01,"$25,000 to $29,999",2125755,1698010
|
||||
2021-01-01,"$30,000 to $34,999",1922550,1542910
|
||||
2021-01-01,"$35,000 to $39,999",1801130,1480060
|
||||
2021-01-01,"$40,000 to $44,999",1712405,1438020
|
||||
2021-01-01,"$45,000 to $49,999",1578315,1344745
|
||||
2021-01-01,"$50,000 to $54,999",1423630,1200385
|
||||
2021-01-01,"$55,000 to $59,999",1253835,1056840
|
||||
2021-01-01,"$60,000 to $69,999",2073335,1751840
|
||||
2021-01-01,"$70,000 to $79,999",1592465,1351425
|
||||
2021-01-01,"$80,000 to $89,999",1239395,1078305
|
||||
2021-01-01,"$90,000 to $99,999",965945,821840
|
||||
2021-01-01,"$100,000 and over",3160245,2819590
|
||||
2021-01-01,"$100,000 to $149,999",2102630,1874030
|
||||
2021-01-01,"$150,000 and over",1057615,945555
|
||||
2021-01-01,Median total income ($),41200,37200
|
|
13
revenu-universel-exemption-impots.Rproj
Normal file
13
revenu-universel-exemption-impots.Rproj
Normal file
|
@ -0,0 +1,13 @@
|
|||
Version: 1.0
|
||||
|
||||
RestoreWorkspace: Default
|
||||
SaveWorkspace: Default
|
||||
AlwaysSaveHistory: Default
|
||||
|
||||
EnableCodeIndexing: Yes
|
||||
UseSpacesForTab: Yes
|
||||
NumSpacesForTab: 2
|
||||
Encoding: UTF-8
|
||||
|
||||
RnwWeave: Sweave
|
||||
LaTeX: pdfLaTeX
|
Loading…
Add table
Reference in a new issue