Skip to content

metrosp

2.0.0Package record

São Paulo Metro Passenger Demand Data

0packages depend
1.4Kdownloads / year
93.7%test coverage
13/13flavors OK

Overview

About

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.

Changes in 2.0.0

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 = 99 system rows from line_entries_monthly and line_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 in rail_lines and rail_stations to 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 its mdu usually comes within 2% of the line's mdu in line_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 in station_entries_daily. METRO-era Line 5 (January 2016 to July 2018) is unchanged.
  • Added Line 4 to line_transported_monthly from 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_monthly now counts individual passengers, like the other demand datasets. METRO publishes transported counts in thousands, and 1.x kept that unit; value is now multiplied by 1000. read_metro_demand() rescales 1.x release assets the same way.
  • Replaced metrosp_cache_dir(), metrosp_cache_enable(), and metrosp_cache_list() with metrosp_cache(), which returns the cache listing and prints its location. Downloads now use the platform-specific tools::R_user_dir() cache by default; cache = FALSE, options(metrosp.cache_dir = "/path"), and METROSP_CACHE_DIR continue 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 rolling data-latest release. A 1.x asset is translated to the 2.0 contract on read — columns renamed, station_id filled in, and the line_number = 99 rows dropped — so a read returns the same shape and the same totals whichever vintage it came from. An unrecognized vintage is now an error rather than a silent fall back to the bundled snapshot (#25).
  • Unshipped the incomplete station_inauguration dataset without replacement. Its source and builder remain under data-raw/ for future curation (#25).
  • Added a stable, opaque station_id to both station-demand datasets and the station geometry table. Named station members retain their official station_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 to metric, metric_name, and metric_name_pt, made station_transported_monthly explicitly use the mdu metric, and made year and line_number integer columns. calendar_spo now uses is_optional_holiday and is_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 on metrosp.cache_ttl like data-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 sf is attached.
  • Fixed the package description and the data article describing station demand as entries. station_transported_monthly reports average weekday passengers transported, and station_entries_daily counts transfers from other operators but not transfers between METRO lines.
  • Fixed metrosp_cache_clear() and read_metro_demand() accepting vintage values such as "data-latest/.." that resolve outside the cache's vintage directories. vintage now accepts only "latest" or a year-month, with or without the data- prefix.
  • Corrected the station_entries_daily docs: monthly station sums usually match line totals in line_entries_monthly but can differ by a fraction of a percent (#43).
  • Excluded .posit/ from source package builds (#42).

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 2.2 min · r-oldrel-windows-x86_64
Status changes
  • 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
Advisories

none known

Documentation

In release 2.0.0
READMEYes · 742 wordsVignettesYes · 2 · dynamicNEWSYes · 100% structured · mentions 2.0.0Citation fileNoWebsiteYes · pkgdown

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%

Downloads

1.4K
CRAN downloads in the past year
Rank #15,535 · ~4/day · ~113/mo
Daily download trend is not available in this view yet.
34430 days
77790 days
1.4K1 year
Compare downloads with other packages →
Also on37 r2u4 autocran

Repository

1Stars
0Forks
4Open issues
0Open PRs
5Releases
224Commits
2Commit identities
opendatapublic-transportationsao-paulosmart-citiessubway
224 commits · Last activity 2026-10-13 · 0% stars, 30d
Responsiveness
How these are sampled
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

2026-07-07 · 02026-08-16 · 1
PracticesBeta

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.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

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)

Reproducibility and dev environment (1)
data-raw/
CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Show all practicesHide 2 practices
Research and citation (1)
CITATION.cff
Lint, format, editor (2)
Lint workflowRStudio project
How this is detected·Detection ruleset v3 (2026-09-26)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2026-02-12
    Seen in the repository: CLAUDE.md
    Named in .Rbuildignore: .claude, CLAUDE.md
    Named in .gitignore: .claude, CLAUDE.md
    Pull request it wrote: opened by a project member
    Commits: 1 by its own account · at least 145 crediting it in the message
  • Posit Assistantfirst seen 2026-10-05
    Seen in the repository: .posit/assistant
Shared conventions any agent may read, so they name no particular tool.
Seen in the repository: AGENTS.md
Models named in its commits
  • 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.

Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
17 external dependencies (excludes base and recommended)

Installing metrosp adds 2 packages (2 with compiled code, 1.6 MB of source tarballs). Heaviest: jsonlite 1.0 MB, cli 629 KB.

Depends (1)
R >= 4.0.0
Imports (4)
clijsonlitetoolsutils
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (1)
Author, Maintainer since 1.0.0 (2026), Copyright holder
Releases (3)

Pick two releases to compare their code metrics.

  • 2.0.0Latest
    record
    2026-09-03 · current release · diff ↗ ·
    added 3 exports
    metrosp_cache, metrosp_cache_clear, read_metro_demand
  • 1.2.1
    record
    2026-09-03 · diff ↗
  • 1.0.0
    record
    2026-05-05
  • R
    R 4.6.0 released · 2026-04-24

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")
Oike, V. (2026). metrosp: São Paulo Metro Passenger Demand Data (Version 2.0.0) [Computer software]. https://doi.org/10.32614/CRAN.package.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.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for metrosp version 2.0.0 [Data set]. HJJB, LLC. Data release v2026-10-18. https://doi.org/10.5281/zenodo.21843040

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.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy