Skip to content

Commit c1e6400

Browse files
dshkolclaude
andcommitted
Add: R code reproducibility sections to 111 existing articles
Backfilled all English articles with collapsible R code sections showing how to extract and reproduce the data using the cansim package. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c69110a commit c1e6400

111 files changed

Lines changed: 4331 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/en/airline-passengers-august-2025/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,26 @@ This is a backfill article covering August 2025 data, published as part of the D
126126

127127
</div>
128128

129+
<details>
130+
<summary>Reproducibility: R code for data extraction</summary>
131+
132+
```r
133+
library(cansim)
134+
library(dplyr)
135+
136+
# Fetch airline operating statistics
137+
airline <- get_cansim("23-10-0253")
138+
139+
# Total passengers
140+
passengers <- airline %>%
141+
filter(`Operating carrier` == "Total, all carriers",
142+
`Operating statistics` == "Passengers") %>%
143+
select(REF_DATE, VALUE) %>%
144+
arrange(desc(REF_DATE))
145+
```
146+
147+
</details>
148+
129149
<div class="source-info">
130150

131151
**Source:** Statistics Canada, [Table 23-10-0079](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=2310007901)

docs/en/airline-passengers-october-2025/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@ Data cover the operating and financial statistics for major Canadian air carrier
7676

7777
</div>
7878

79+
<details>
80+
<summary>Reproducibility: R code for data extraction</summary>
81+
82+
```r
83+
library(cansim)
84+
library(dplyr)
85+
86+
# Fetch airline operating statistics
87+
airline <- get_cansim("23-10-0253")
88+
89+
# Total passengers
90+
passengers <- airline %>%
91+
filter(`Operating carrier` == "Total, all carriers",
92+
`Operating statistics` == "Passengers") %>%
93+
select(REF_DATE, VALUE) %>%
94+
arrange(desc(REF_DATE))
95+
```
96+
97+
</details>
98+
7999
<div class="source-info">
80100

81101
**Source:** Statistics Canada, [Table 23-10-0079](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=2310007901)

docs/en/airline-passengers-september-2025/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,26 @@ This backfill article covers September 2025 data as part of The D-AI-LY historic
128128

129129
</div>
130130

131+
<details>
132+
<summary>Reproducibility: R code for data extraction</summary>
133+
134+
```r
135+
library(cansim)
136+
library(dplyr)
137+
138+
# Fetch airline operating statistics
139+
airline <- get_cansim("23-10-0253")
140+
141+
# Total passengers
142+
passengers <- airline %>%
143+
filter(`Operating carrier` == "Total, all carriers",
144+
`Operating statistics` == "Passengers") %>%
145+
select(REF_DATE, VALUE) %>%
146+
arrange(desc(REF_DATE))
147+
```
148+
149+
</details>
150+
131151
<div class="source-info">
132152

133153
**Source:** Statistics Canada, [Table 23-10-0079](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=2310007901)

docs/en/building-permits-august-2025/index.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,44 @@ This is a backfill article covering August 2025 data, published as part of the D
133133

134134
</div>
135135

136+
<details>
137+
<summary>Reproducibility: R code for data extraction</summary>
138+
139+
```r
140+
library(cansim)
141+
library(dplyr)
142+
143+
# Fetch building permits data
144+
permits <- get_cansim("34-10-0066")
145+
146+
# Total building permits value
147+
total_permits <- permits %>%
148+
filter(GEO == "Canada",
149+
`Type of structure` == "Total residential and non-residential",
150+
`Type of permit and value` == "Total permits, value") %>%
151+
select(REF_DATE, VALUE) %>%
152+
arrange(desc(REF_DATE))
153+
154+
# By type of structure
155+
by_type <- permits %>%
156+
filter(GEO == "Canada",
157+
REF_DATE == "2025-08",
158+
`Type of permit and value` == "Total permits, value") %>%
159+
select(`Type of structure`, VALUE) %>%
160+
arrange(desc(VALUE))
161+
162+
# Provincial breakdown
163+
provincial <- permits %>%
164+
filter(`Type of structure` == "Total residential and non-residential",
165+
`Type of permit and value` == "Total permits, value",
166+
REF_DATE == "2025-08",
167+
GEO != "Canada") %>%
168+
select(GEO, VALUE) %>%
169+
arrange(desc(VALUE))
170+
```
171+
172+
</details>
173+
136174
<div class="source-info">
137175

138176
**Source:** Statistics Canada, [Table 34-10-0292](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=3410029201)

docs/en/building-permits-october-2025/index.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,44 @@ Data are seasonally adjusted to account for regular seasonal patterns in constru
150150

151151
</div>
152152

153+
<details>
154+
<summary>Reproducibility: R code for data extraction</summary>
155+
156+
```r
157+
library(cansim)
158+
library(dplyr)
159+
160+
# Fetch building permits data
161+
permits <- get_cansim("34-10-0066")
162+
163+
# Total building permits value
164+
total_permits <- permits %>%
165+
filter(GEO == "Canada",
166+
`Type of structure` == "Total residential and non-residential",
167+
`Type of permit and value` == "Total permits, value") %>%
168+
select(REF_DATE, VALUE) %>%
169+
arrange(desc(REF_DATE))
170+
171+
# By type of structure
172+
by_type <- permits %>%
173+
filter(GEO == "Canada",
174+
REF_DATE == "2025-10",
175+
`Type of permit and value` == "Total permits, value") %>%
176+
select(`Type of structure`, VALUE) %>%
177+
arrange(desc(VALUE))
178+
179+
# Provincial breakdown
180+
provincial <- permits %>%
181+
filter(`Type of structure` == "Total residential and non-residential",
182+
`Type of permit and value` == "Total permits, value",
183+
REF_DATE == "2025-10",
184+
GEO != "Canada") %>%
185+
select(GEO, VALUE) %>%
186+
arrange(desc(VALUE))
187+
```
188+
189+
</details>
190+
153191
<div class="source-info">
154192

155193
**Source:** Statistics Canada, [Table 34-10-0292](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=3410029201)

docs/en/building-permits-september-2025/index.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,44 @@ This backfill article covers September 2025 data as part of The D-AI-LY historic
135135

136136
</div>
137137

138+
<details>
139+
<summary>Reproducibility: R code for data extraction</summary>
140+
141+
```r
142+
library(cansim)
143+
library(dplyr)
144+
145+
# Fetch building permits data
146+
permits <- get_cansim("34-10-0066")
147+
148+
# Total building permits value
149+
total_permits <- permits %>%
150+
filter(GEO == "Canada",
151+
`Type of structure` == "Total residential and non-residential",
152+
`Type of permit and value` == "Total permits, value") %>%
153+
select(REF_DATE, VALUE) %>%
154+
arrange(desc(REF_DATE))
155+
156+
# By type of structure
157+
by_type <- permits %>%
158+
filter(GEO == "Canada",
159+
REF_DATE == "2025-09",
160+
`Type of permit and value` == "Total permits, value") %>%
161+
select(`Type of structure`, VALUE) %>%
162+
arrange(desc(VALUE))
163+
164+
# Provincial breakdown
165+
provincial <- permits %>%
166+
filter(`Type of structure` == "Total residential and non-residential",
167+
`Type of permit and value` == "Total permits, value",
168+
REF_DATE == "2025-09",
169+
GEO != "Canada") %>%
170+
select(GEO, VALUE) %>%
171+
arrange(desc(VALUE))
172+
```
173+
174+
</details>
175+
138176
<div class="source-info">
139177

140178
**Source:** Statistics Canada, [Table 34-10-0292](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=3410029201)

docs/en/construction-wages-november-2025/index.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,34 @@ The construction union wage rate index measures changes in basic wage rates nego
169169

170170
</div>
171171

172+
<details>
173+
<summary>Reproducibility: R code for data extraction</summary>
174+
175+
```r
176+
library(cansim)
177+
library(dplyr)
178+
179+
# Fetch construction wage rate index
180+
wages <- get_cansim("18-10-0140")
181+
182+
# National index by trade
183+
by_trade <- wages %>%
184+
filter(GEO == "Canada",
185+
REF_DATE == "2025-11") %>%
186+
select(`Type of trade`, VALUE) %>%
187+
arrange(desc(VALUE))
188+
189+
# By city
190+
by_city <- wages %>%
191+
filter(`Type of trade` == "Composite",
192+
REF_DATE == "2025-11",
193+
GEO != "Canada") %>%
194+
select(GEO, VALUE) %>%
195+
arrange(desc(VALUE))
196+
```
197+
198+
</details>
199+
172200
<div class="source-info">
173201

174202
**Source:** Statistics Canada, [Table 18-10-0140](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810014001)

docs/en/cpi-april-2025/index.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,47 @@ This is a backfill article covering April 2025 data, published as part of the D-
122122

123123
</div>
124124

125+
<details>
126+
<summary>Reproducibility: R code for data extraction</summary>
127+
128+
```r
129+
library(cansim)
130+
library(dplyr)
131+
132+
# Fetch CPI data
133+
cpi <- get_cansim("18-10-0004")
134+
135+
# National all-items CPI time series
136+
national_cpi <- cpi %>%
137+
filter(GEO == "Canada",
138+
`Products and product groups` == "All-items") %>%
139+
select(REF_DATE, VALUE) %>%
140+
arrange(desc(REF_DATE))
141+
142+
# Year-over-year change calculation
143+
current <- national_cpi %>% filter(REF_DATE == "2025-04") %>% pull(VALUE)
144+
previous <- national_cpi %>% filter(REF_DATE == "2024-04") %>% pull(VALUE)
145+
yoy_change <- (current - previous) / previous * 100
146+
147+
# Component breakdown
148+
components <- cpi %>%
149+
filter(GEO == "Canada",
150+
REF_DATE == "2025-04") %>%
151+
select(`Products and product groups`, VALUE) %>%
152+
arrange(desc(VALUE))
153+
154+
# Provincial variation
155+
provincial <- cpi %>%
156+
filter(`Products and product groups` == "All-items",
157+
REF_DATE %in% c("2025-04", "2024-04"),
158+
GEO != "Canada") %>%
159+
select(GEO, REF_DATE, VALUE) %>%
160+
pivot_wider(names_from = REF_DATE, values_from = VALUE) %>%
161+
mutate(yoy_change = (`2025-04` - `2024-04`) / `2024-04` * 100)
162+
```
163+
164+
</details>
165+
125166
<div class="source-info">
126167

127168
**Source:** Statistics Canada, [Table 18-10-0004](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000401)

docs/en/cpi-august-2025/index.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,47 @@ The CPI is not seasonally adjusted. Month-to-month movements can reflect seasona
124124

125125
</div>
126126

127+
<details>
128+
<summary>Reproducibility: R code for data extraction</summary>
129+
130+
```r
131+
library(cansim)
132+
library(dplyr)
133+
134+
# Fetch CPI data
135+
cpi <- get_cansim("18-10-0004")
136+
137+
# National all-items CPI time series
138+
national_cpi <- cpi %>%
139+
filter(GEO == "Canada",
140+
`Products and product groups` == "All-items") %>%
141+
select(REF_DATE, VALUE) %>%
142+
arrange(desc(REF_DATE))
143+
144+
# Year-over-year change calculation
145+
current <- national_cpi %>% filter(REF_DATE == "2025-08") %>% pull(VALUE)
146+
previous <- national_cpi %>% filter(REF_DATE == "2024-08") %>% pull(VALUE)
147+
yoy_change <- (current - previous) / previous * 100
148+
149+
# Component breakdown
150+
components <- cpi %>%
151+
filter(GEO == "Canada",
152+
REF_DATE == "2025-08") %>%
153+
select(`Products and product groups`, VALUE) %>%
154+
arrange(desc(VALUE))
155+
156+
# Provincial variation
157+
provincial <- cpi %>%
158+
filter(`Products and product groups` == "All-items",
159+
REF_DATE %in% c("2025-08", "2024-08"),
160+
GEO != "Canada") %>%
161+
select(GEO, REF_DATE, VALUE) %>%
162+
pivot_wider(names_from = REF_DATE, values_from = VALUE) %>%
163+
mutate(yoy_change = (`2025-08` - `2024-08`) / `2024-08` * 100)
164+
```
165+
166+
</details>
167+
127168
<div class="source-info">
128169

129170
**Source:** Statistics Canada, Table 18-10-0004

docs/en/cpi-december-2024/index.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,47 @@ This is a backfill article covering December 2024 data, published as part of the
122122

123123
</div>
124124

125+
<details>
126+
<summary>Reproducibility: R code for data extraction</summary>
127+
128+
```r
129+
library(cansim)
130+
library(dplyr)
131+
132+
# Fetch CPI data
133+
cpi <- get_cansim("18-10-0004")
134+
135+
# National all-items CPI time series
136+
national_cpi <- cpi %>%
137+
filter(GEO == "Canada",
138+
`Products and product groups` == "All-items") %>%
139+
select(REF_DATE, VALUE) %>%
140+
arrange(desc(REF_DATE))
141+
142+
# Year-over-year change calculation
143+
current <- national_cpi %>% filter(REF_DATE == "2024-12") %>% pull(VALUE)
144+
previous <- national_cpi %>% filter(REF_DATE == "2023-12") %>% pull(VALUE)
145+
yoy_change <- (current - previous) / previous * 100
146+
147+
# Component breakdown
148+
components <- cpi %>%
149+
filter(GEO == "Canada",
150+
REF_DATE == "2024-12") %>%
151+
select(`Products and product groups`, VALUE) %>%
152+
arrange(desc(VALUE))
153+
154+
# Provincial variation
155+
provincial <- cpi %>%
156+
filter(`Products and product groups` == "All-items",
157+
REF_DATE %in% c("2024-12", "2023-12"),
158+
GEO != "Canada") %>%
159+
select(GEO, REF_DATE, VALUE) %>%
160+
pivot_wider(names_from = REF_DATE, values_from = VALUE) %>%
161+
mutate(yoy_change = (`2024-12` - `2023-12`) / `2023-12` * 100)
162+
```
163+
164+
</details>
165+
125166
<div class="source-info">
126167

127168
**Source:** Statistics Canada, [Table 18-10-0004](https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1810000401)

0 commit comments

Comments
 (0)