São Paulo Metro Passenger Demand Data
Overview
Provides passenger demand data for the São Paulo metro system, covering 2012 to 2026. Datasets include monthly passenger entries and transported counts by line, average weekday passengers transported by station, daily station entries, and spatial geometries for metro and commuter train lines and stations. The bundled datasets are a fixed snapshot, so analyses stay reproducible and examples run offline. More recent data is published to 'GitHub' releases as the upstream sources are updated, and read_metro_demand() downloads, caches, and reads it, optionally pinned to a dated monthly batch.
Breaking changes
The exported datasets now use a consistent <grain>_<measure>_<frequency> convention:
| 1.x name | 2.0 name |
|---|---|
| passengers_entrance | line_entries_monthly |
| passengers_transported | line_transported_monthly |
| station_averages | station_transported_monthly |
| station_daily | station_entries_daily |
| lines | rail_lines |
| stations | rail_stations |
| station_inauguration | Unshipped |
| calendar_spo | Unchanged |
Show all changes in 2.0.0Hide the rest of the changes in 2.0.0
| metro_colors | Unchanged |
- Removed the published
line_number = 99system rows fromline_entries_monthlyandline_transported_monthly. They did not provide a consistent whole-network measure. No clean network total exists across operators: METRO line entries include transfers arriving from Lines 4 and 5, while Lines 4 and 5 count turnstiles only. Do not sum transported counts because interchange journeys are counted on every line used. Corrected the operator for Line 5 inrail_linesandrail_stationsto ViaMobilidade (#22). - Renamed the station monthly dataset to
station_transported_monthly: METRO's file measures transported passengers (boardings plus transfers), not turnstile entries. Summed over a line's stations itsmduusually comes within 2% of the line'smduinline_transported_monthly. - Dropped Line 5 rows from August 2018 onward from
station_transported_monthly. The Dataverse feed records turnstiles only after the ViaMobilidade handover, so those rows are neither measure; station data for that era stays instation_entries_daily. METRO-era Line 5 (January 2016 to July 2018) is unchanged. - Added Line 4 to
line_transported_monthlyfrom January 2012 with all five metrics, summing turnstile entries and transfers from the Dataverse feed. Line 5 stays absent after August 2018: its feed records no transfers. line_transported_monthlynow counts individual passengers, like the other demand datasets. METRO publishes transported counts in thousands, and 1.x kept that unit;valueis now multiplied by 1000.read_metro_demand()rescales 1.x release assets the same way.- Replaced
metrosp_cache_dir(),metrosp_cache_enable(), andmetrosp_cache_list()withmetrosp_cache(), which returns the cache listing and prints its location. Downloads now use the platform-specifictools::R_user_dir()cache by default;cache = FALSE,options(metrosp.cache_dir = "/path"), andMETROSP_CACHE_DIRcontinue to opt out or override the location.metrosp_cache_clear()removes only package-managed vintage directories, preserving unrelated files in a custom cache root. A cached vintage left unused for 90 days is deleted on the next read (#26). read_metro_demand()accepts the new dataset names and detects 1.x asset names from each release manifest, including the rollingdata-latestrelease. A 1.x asset is translated to the 2.0 contract on read — columns renamed,station_idfilled in, and theline_number = 99rows dropped — so a read returns the same shape and the same totals whichever vintage it came from. An unrecognizedvintageis now an error rather than a silent fall back to the bundled snapshot (#25).- Unshipped the incomplete
station_inaugurationdataset without replacement. Its source and builder remain underdata-raw/for future curation (#25). - Added a stable, opaque
station_idto both station-demand datasets and the station geometry table. Named station members retain their officialstation_name, while officially documented physical interchange complexes share an ID across lines and modes. Complex membership comes from a committed, source-backed crosswalk rather than name or distance inference (#24). - Standardized the four demand datasets on
value, renamed the metric columns tometric,metric_name, andmetric_name_pt, madestation_transported_monthlyexplicitly use themdumetric, and madeyearandline_numberinteger columns.calendar_sponow usesis_optional_holidayandis_long_weekend(#23).
Migrating from 1.x
The metric rename changes meaning: in 1.x it contained the English label, while in 2.0 it contains the stable abbreviated code. Code that groups, filters, or pivots on metric columns should use this mapping:
| 1.x column | 2.0 column | Meaning |
|---|---|---|
| metric_abb | metric | Stable code such as total or mdu |
| metric | metric_name | English display label |
| metric_pt | metric_name_pt | Portuguese display label |
The measure columns passengers and avg_passenger are now consistently named value. The calendar columns is_ponto_facultativo and is_feriadao are now is_optional_holiday and is_long_weekend.
line_transported_monthly$value is 1000 times its 1.x value. Remove any * 1000 your code applied before comparing it with the entry counts.
Code that previously used line_number == 99 has no replacement network total: METRO line entries include transfers from Lines 4 and 5 while those lines count turnstiles only, and transported counts double-count interchange journeys. Do not sum transported counts: a passenger is counted on every line used, so interchange journeys would be counted more than once.
Only vintages that were actually published can be pinned. The first dated archive is data-2026-09; earlier year-month tags do not exist.
Minor improvements and fixes
- Fixed
read_metro_demand()keeping a dated vintage's cached manifest forever. Dated manifests now expire onmetrosp.cache_ttllikedata-latest, so a month republished after the first read is picked up. Monthly vintages are revisable within their month, not immutable. - Fixed archived station-name lookup failing when
sfis attached. - Fixed the package description and the data article describing station demand as entries.
station_transported_monthlyreports average weekday passengers transported, andstation_entries_dailycounts transfers from other operators but not transfers between METRO lines. - Fixed
metrosp_cache_clear()andread_metro_demand()acceptingvintagevalues such as"data-latest/.."that resolve outside the cache's vintage directories.vintagenow accepts only"latest"or a year-month, with or without thedata-prefix. - Corrected the
station_entries_dailydocs: monthly station sums usually match line totals inline_entries_monthlybut can differ by a fraction of a percent (#43). - Excluded
.posit/from source package builds (#42).
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-07-16
- WARNING12 OK, 1 WARNING2026-07-15
- OK13 OK2026-06-08
Show 2 earlier changesHide 2 earlier changes
- WARNING12 OK, 1 WARNING2026-06-07
- OK7 OK2026-05-06
Documentation
The repository also keeps web-only articles.
- Help pages
- 11
- Examples that run
- 100%3 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 90%
- Return-value docs
- 100%
- Help pages citing references
- 0%
- data-dictionary HTML
- getting_started HTML
Downloads
Repository
- PRs merged (all time)
- 92%
- Median days to close, 50 most recently updated closed issues
- 13
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Releases over time
Issues over time
PRs over time
Commits over time
12 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/viniciusoike/metrosp on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-05 · The repository has a site deploy workflow
pkgdown site last built 2026-10-05, before release 2.0.0 (2026-10-06)
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-02-12Seen in the repository: CLAUDE.mdNamed in .Rbuildignore: .claude, CLAUDE.mdNamed in .gitignore: .claude, CLAUDE.mdPull request it wrote: opened by a project memberCommits: 1 by its own account · at least 145 crediting it in the message
- Posit Assistantfirst seen 2026-10-05Seen in the repository: .posit/assistant
- Claude Sonnet 4.639 commits · Feb to May 2026
- Claude Opus 4.628 commits · Feb to Jun 2026
- Claude Opus 4.818 commits · May to Jun 2026
- Claude Sonnet 511 commits · Jul 2026
- Claude Opus 58 commits · Aug 2026
2 more models not listed. Some of these counts are a minimum, because the search stopped before the oldest commits.
Dependencies
Code & Tests
Datasets
People & History
Package metadata
- First published
- 2026-05-05
- Total releases
- 3 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.0.0
- Bundled data
- 894 KB / 8 files
- Download size
- 2.5 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("metrosp")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.