Skip to content

Commit 37de42c

Browse files
committed
v2026.5.13
1 parent 44c8eb3 commit 37de42c

45 files changed

Lines changed: 396 additions & 162 deletions

Some content is hidden

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

.claude/rules/r_targets.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@ If the general targets scaffolding (`_targets.R`, etc.) does not exist, create
88

99
## Development workflow
1010

11-
Re-run the targets pipeline after any changes: `Rscript -e 'targets::tar_make()'`.
11+
### After any edit to pipeline code
12+
13+
An edit to `_targets.R`, `packages.R`, or any function in `R/` is **not complete** until you have run `Rscript -e 'targets::tar_make()'` and observed it finish without error. This applies regardless of how small the change appears, including:
14+
15+
- Renaming a variable or argument
16+
- Changing a default value
17+
- Reformatting or moving code between files
18+
- Edits you believe are "obviously correct"
19+
20+
If a full `tar_make()` is too expensive (e.g. hits external APIs), scope it with `tar_make(names = c(...))` to the affected targets, but still run it. Never substitute reasoning ("the change is trivial") for execution.
21+
22+
If you didn't run it, say so explicitly in your summary: *"I did not run `tar_make()` because …"* — don't let the omission go unmentioned.
23+
24+
### Inspecting targets
1225

1326
To inspect targets interactively or in ad hoc scripts, first call `targets::tar_load_globals()` to load all packages and functions, then use `tar_load()` or `tar_read()` to access built targets.
1427

.github/workflows/R-CMD-check.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
name: R-CMD-check.yaml
9+
10+
permissions: read-all
11+
12+
jobs:
13+
R-CMD-check:
14+
runs-on: ${{ matrix.config.os }}
15+
16+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
config:
22+
- {os: ubuntu-latest, r: 'release'}
23+
24+
env:
25+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
26+
R_KEEP_PKG_SOURCE: yes
27+
28+
steps:
29+
- uses: actions/checkout@v6
30+
31+
- uses: r-lib/actions/setup-pandoc@v2
32+
33+
- uses: r-lib/actions/setup-r@v2
34+
with:
35+
r-version: ${{ matrix.config.r }}
36+
http-user-agent: ${{ matrix.config.http-user-agent }}
37+
38+
- uses: r-lib/actions/setup-r-dependencies@v2
39+
with:
40+
extra-packages: any::rcmdcheck
41+
needs: check
42+
43+
- uses: r-lib/actions/check-r-package@v2
44+
with:
45+
upload-snapshots: true
46+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

.github/workflows/README.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
on:
2+
push:
3+
branches: [main, master]
4+
pull_request:
5+
6+
name: README.yaml
7+
8+
permissions: read-all
9+
10+
jobs:
11+
README:
12+
runs-on: ubuntu-latest
13+
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
17+
steps:
18+
- uses: actions/checkout@v6
19+
20+
- uses: r-lib/actions/setup-pandoc@v2
21+
22+
- uses: r-lib/actions/setup-r@v2
23+
with:
24+
use-public-rspm: true
25+
26+
- uses: r-lib/actions/setup-r-dependencies@v2
27+
with:
28+
extra-packages: any::devtools, local::.
29+
needs: readme
30+
31+
- name: Rebuild README.md
32+
run: Rscript -e 'devtools::build_readme()'
33+
34+
- name: Check README.md is up to date
35+
run: git diff --exit-code -- README.md

DESCRIPTION

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: realtalk
22
Type: Package
33
Title: Price index data for the US economy
4-
Version: 2026.4.26
4+
Version: 2026.5.13
55
Authors@R: c(
66
person("Ben", "Zipperer", , "bzipperer@epi.org", role = c("aut", "cre")),
77
person("Economic Policy Institute", role = c("cph", "fnd"))
@@ -16,3 +16,7 @@ RoxygenNote: 7.3.3
1616
Roxygen: list(markdown = TRUE)
1717
URL: https://economic.github.io/realtalk/
1818
Config/Needs/website: economic/epitemplate
19+
Suggests:
20+
epidatatools,
21+
testthat (>= 3.0.0)
22+
Config/testthat/edition: 3

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Version 2026.5.13
2+
* update CPI-based data through April 2026
3+
* update PCE through March 2026
4+
15
## Version 2026.4.26
26
* ensure monthly minimum wage example data is full-year
37

README.Rmd

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ knitr::opts_chunk$set(
2323
# realtalk <a href="https://economic.github.io/realtalk/"><img src="man/figures/logo.png" align="right" width="120" /></a>
2424

2525
<!-- badges: start -->
26+
[![R-CMD-check](https://github.com/Economic/realtalk/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Economic/realtalk/actions/workflows/R-CMD-check.yaml)
2627
<!-- badges: end -->
2728

2829
realtalk makes it easy to use common US price indexes in R.
@@ -102,6 +103,24 @@ get_price_index("PCE", "monthly", "SA")
102103
```
103104

104105
## Installation
106+
Install realtalk from r-universe:
107+
108+
``` r
109+
install.packages(
110+
"realtalk",
111+
repos = c("https://economic.r-universe.dev", getOption("repos"))
112+
)
113+
```
114+
115+
If you add the EPI r-universe repository to your `.Rprofile` with
105116
``` r
106-
install.packages('realtalk', repos = c('https://economic.r-universe.dev'))
117+
# Example .Rprofile
118+
options(repos = c(
119+
EPI = "https://economic.r-universe.dev",
120+
getOption("repos")
121+
))
107122
```
123+
then you can simply
124+
``` r
125+
install.packages("realtalk")
126+
```

README.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
<!-- badges: start -->
66

7+
[![R-CMD-check](https://github.com/Economic/realtalk/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Economic/realtalk/actions/workflows/R-CMD-check.yaml)
78
<!-- badges: end -->
89

910
realtalk makes it easy to use common US price indexes in R.
@@ -43,35 +44,35 @@ available_price_indexes
4344
#> index_name frequency seasonal min_date max_date package_data_name
4445
#> <chr> <chr> <chr> <chr> <chr> <chr>
4546
#> 1 C-CPI-U annual <NA> 2000 2025 c_cpi_u_annual
46-
#> 2 C-CPI-U monthly NSA Dec 1999 Mar 2026 c_cpi_u_monthly_nsa
47+
#> 2 C-CPI-U monthly NSA Dec 1999 Apr 2026 c_cpi_u_monthly_nsa
4748
#> 3 C-CPI-U quarterly NSA 2000q1 2026q1 c_cpi_u_quarterly_nsa
4849
#> 4 C-CPI-U, extended annual <NA> 1937 2025 c_cpi_u_extended_annu…
49-
#> 5 C-CPI-U, extended monthly NSA Jan 1937 Mar 2026 c_cpi_u_extended_mont…
50-
#> 6 C-CPI-U, extended monthly SA Jan 1947 Mar 2026 c_cpi_u_extended_mont…
50+
#> 5 C-CPI-U, extended monthly NSA Jan 1937 Apr 2026 c_cpi_u_extended_mont…
51+
#> 6 C-CPI-U, extended monthly SA Jan 1947 Apr 2026 c_cpi_u_extended_mont…
5152
#> 7 C-CPI-U, extended quarterly NSA 1937q1 2026q1 c_cpi_u_extended_quar…
5253
#> 8 C-CPI-U, extended quarterly SA 1947q1 2026q1 c_cpi_u_extended_quar…
5354
#> 9 CPI-U annual <NA> 1937 2025 cpi_u_annual
54-
#> 10 CPI-U monthly NSA Jan 1937 Mar 2026 cpi_u_monthly_nsa
55-
#> 11 CPI-U monthly SA Jan 1947 Mar 2026 cpi_u_monthly_sa
55+
#> 10 CPI-U monthly NSA Jan 1937 Apr 2026 cpi_u_monthly_nsa
56+
#> 11 CPI-U monthly SA Jan 1947 Apr 2026 cpi_u_monthly_sa
5657
#> 12 CPI-U quarterly NSA 1937q1 2026q1 cpi_u_quarterly_nsa
5758
#> 13 CPI-U quarterly SA 1947q1 2026q1 cpi_u_quarterly_sa
5859
#> 14 CPI-U-RS annual <NA> 1978 2025 cpi_u_rs_annual
5960
#> 15 CPI-U-RS monthly NSA Dec 1977 Dec 2025 cpi_u_rs_monthly_nsa
6061
#> 16 CPI-U-X1 annual <NA> 1967 1982 cpi_u_x1_annual
6162
#> 17 CPI-U-X1 monthly NSA Jan 1967 Dec 1982 cpi_u_x1_monthly_nsa
6263
#> 18 PCE annual <NA> 1929 2025 pce_annual
63-
#> 19 PCE monthly SA Jan 1959 Feb 2026 pce_monthly_sa
64-
#> 20 PCE quarterly SA 1947q1 2025q4 pce_quarterly_sa
64+
#> 19 PCE monthly SA Jan 1959 Mar 2026 pce_monthly_sa
65+
#> 20 PCE quarterly SA 1947q1 2026q1 pce_quarterly_sa
6566
```
6667

6768
The `package_data_name` column contains the internal name of each
6869
dataset:
6970

7071
``` r
7172
pce_monthly_sa
72-
#> # A tibble: 806 × 3
73+
#> # A tibble: 807 × 3
7374
#> year month pce
74-
#> <dbl> <dbl> <dbl>
75+
#> <int> <int> <dbl>
7576
#> 1 1959 1 15.2
7677
#> 2 1959 2 15.2
7778
#> 3 1959 3 15.2
@@ -82,16 +83,16 @@ pce_monthly_sa
8283
#> 8 1959 8 15.3
8384
#> 9 1959 9 15.4
8485
#> 10 1959 10 15.4
85-
#> # ℹ 796 more rows
86+
#> # ℹ 797 more rows
8687
```
8788

8889
You can also use `get_price_index()`:
8990

9091
``` r
9192
get_price_index("PCE", "monthly", "SA")
92-
#> # A tibble: 806 × 3
93+
#> # A tibble: 807 × 3
9394
#> year month pce
94-
#> <dbl> <dbl> <dbl>
95+
#> <int> <int> <dbl>
9596
#> 1 1959 1 15.2
9697
#> 2 1959 2 15.2
9798
#> 3 1959 3 15.2
@@ -102,11 +103,32 @@ get_price_index("PCE", "monthly", "SA")
102103
#> 8 1959 8 15.3
103104
#> 9 1959 9 15.4
104105
#> 10 1959 10 15.4
105-
#> # ℹ 796 more rows
106+
#> # ℹ 797 more rows
106107
```
107108

108109
## Installation
109110

111+
Install realtalk from r-universe:
112+
113+
``` r
114+
install.packages(
115+
"realtalk",
116+
repos = c("https://economic.r-universe.dev", getOption("repos"))
117+
)
118+
```
119+
120+
If you add the EPI r-universe repository to your `.Rprofile` with
121+
122+
``` r
123+
# Example .Rprofile
124+
options(repos = c(
125+
EPI = "https://economic.r-universe.dev",
126+
getOption("repos")
127+
))
128+
```
129+
130+
then you can simply
131+
110132
``` r
111-
install.packages('realtalk', repos = c('https://economic.r-universe.dev'))
133+
install.packages("realtalk")
112134
```

data-raw/R/clean.R

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
clean_bls_monthly <- function(csv, col_name) {
2-
read_csv(csv, show_col_types = FALSE) |>
1+
clean_bls_monthly <- function(data, col_name) {
2+
data |>
33
select(year, month, !!col_name := value) |>
44
arrange(year, month)
55
}
66

7-
clean_c_cpi_u <- function(csv, known_missing) {
8-
clean_bls_monthly(csv, "c_cpi_u") |>
7+
clean_c_cpi_u <- function(data, known_missing) {
8+
clean_bls_monthly(data, "c_cpi_u") |>
99
add_missing_month_rows(c_cpi_u, known_missing)
1010
}
1111

@@ -62,15 +62,3 @@ clean_cpi_u_rs <- function(csv, known_missing = NULL) {
6262
select(year, month, cpi_u_rs) |>
6363
arrange(year, month)
6464
}
65-
66-
clean_pce <- function(csv) {
67-
read_csv(csv, show_col_types = FALSE)
68-
}
69-
70-
clean_pce_quarterly <- function(csv) {
71-
read_csv(csv, show_col_types = FALSE)
72-
}
73-
74-
clean_pce_annual <- function(csv) {
75-
read_csv(csv, show_col_types = FALSE)
76-
}

data-raw/R/fetchers.R

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,39 @@
1-
fetch_bls_series <- function(series_id, file_path, start_year, end_year) {
1+
fetch_bls_series <- function(
2+
series_id,
3+
start_year,
4+
end_year = year(Sys.Date())
5+
) {
26
get_bls(series_id, start = start_year, end = end_year) |>
37
select(year, month, value) |>
4-
assert_rows(col_concat, is_uniq, year, month) |>
5-
write_csv(file_path)
6-
file_path
8+
assert_rows(col_concat, is_uniq, year, month)
79
}
810

911
fetch_cpi_u_nsa <- function() {
10-
fetch_bls_series("CUUR0000SA0", "data-raw/raw/cpi_u_nsa.csv", 1937, 2026)
12+
fetch_bls_series("CUUR0000SA0", 1937)
1113
}
1214

1315
fetch_cpi_u_sa <- function() {
14-
fetch_bls_series("CUSR0000SA0", "data-raw/raw/cpi_u_sa.csv", 1947, 2026)
16+
fetch_bls_series("CUSR0000SA0", 1947)
1517
}
1618

1719
fetch_c_cpi_u <- function() {
18-
fetch_bls_series("SUUR0000SA0", "data-raw/raw/c_cpi_u_nsa.csv", 1999, 2026)
20+
fetch_bls_series("SUUR0000SA0", 1999)
1921
}
2022

2123
fetch_pce_monthly_sa <- function() {
22-
file_path <- "data-raw/raw/pce_monthly_sa.csv"
2324
get_bea_nipa("T20804", frequency = "month", years = "ALL") |>
2425
filter(line_number == 1) |>
25-
select(year, month, pce = value) |>
26-
write_csv(file_path)
27-
file_path
26+
select(year, month, pce = value)
2827
}
2928

3029
fetch_pce_quarterly_sa <- function() {
31-
file_path <- "data-raw/raw/pce_quarterly_sa.csv"
3230
get_bea_nipa("T20304", frequency = "quarter", years = "ALL") |>
3331
filter(line_number == 1) |>
34-
select(year, quarter, pce = value) |>
35-
write_csv(file_path)
36-
file_path
32+
select(year, quarter, pce = value)
3733
}
3834

3935
fetch_pce_annual <- function() {
40-
file_path <- "data-raw/raw/pce_annual.csv"
4136
get_bea_nipa("T20304", frequency = "year", years = "ALL") |>
4237
filter(line_number == 1) |>
43-
select(year, pce = value) |>
44-
write_csv(file_path)
45-
file_path
38+
select(year, pce = value)
4639
}

0 commit comments

Comments
 (0)