Package 'metrosp'

Title: São Paulo Metro Passenger Demand Data
Description: 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 station entries, daily station entries, and spatial geometries for metro and commuter train lines and stations.
Authors: Vinicius Oike [aut, cre, cph]
Maintainer: Vinicius Oike <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2026-06-07 07:12:52 UTC
Source: https://github.com/viniciusoike/metrosp

Help Index


São Paulo Holiday and Business-Day Calendar

Description

A daily calendar for São Paulo (city) covering 2012–2030, classifying each date as a holiday or business day. Includes national, state, and municipal holidays in São Paulo, with flags for optional work days (is_ponto_facultativo) and extended holiday weekends (is_feriadao).

Usage

calendar_spo

Format

A data frame with one row per day and the following columns:

date

Calendar date (Date).

year

Calendar year (integer).

weekday

Day of week from lubridate::wday(): 1 = Sunday, 2 = Monday, ..., 7 = Saturday (integer).

is_weekend

TRUE for Saturdays and Sundays (logical).

is_holiday

TRUE when the date is a gazetted holiday at any scope (logical).

is_business_day

TRUE when the date is neither a weekend nor a holiday (logical).

holiday_name

Name of the holiday in Portuguese (character). NA on non-holiday dates.

holiday_scope

Scope of the holiday (character). One of "national", "state", or "municipal"; NA on non-holiday dates.

is_ponto_facultativo

TRUE for holidays that are technically optional at the federal level (Carnaval, Corpus Christi) but observed as holidays in São Paulo (logical).

is_feriadao

TRUE when a holiday falls on Monday, Tuesday, Thursday, or Friday, creating a potential extended weekend with the adjacent Saturday/Sunday (logical).

Details

The calendar covers the full date range of the station_daily dataset (Lines 4/5 from January 2012) and extends through 2030 for forecasting use.

See Also

station_daily for daily passenger data that can be joined on date.


Metro and Train Line Routes

Description

Spatial line geometries for São Paulo metro (METRO SP) and commuter train (CPTM) lines, including both currently operating lines and planned future expansions.

Usage

lines

Format

An sf data frame with LINESTRING geometry (CRS: WGS84 / EPSG:4326) and the following columns:

line_number

Official line number (integer).

line_name_pt

Portuguese color name of the line (character).

line_name

English color name of the line (character).

company_name

Operating company name (character).

type

Either "metro" (METRO SP) or "train" (CPTM) (character).

status

Either "current" (operating) or "future" (planned expansion) (character).

geometry

Line route geometry (sfc_LINESTRING).

Details

Requires the sf package to work with spatial features. The distinction between types follows GeoSampa's classification. Broadly, "metro" lines run underground as a subway and "train" lines run above ground as commuter rail, though exceptions exist.

Source

GeoSampa, Prefeitura de São Paulo. https://geosampa.prefeitura.sp.gov.br/

See Also

stations for station point locations.


Metro SP Official Line Colors

Description

A named character vector of official hex color codes for the six metro lines operated by METRO SP (Lines 1–3 and 15) and ViaMobilidade (Lines 4 and 5).

Usage

metro_colors

Format

A named character vector of length 6. Names are English color names; values are hex color codes:

Blue

Line 1 — "#171796"

Green

Line 2 — "#007A5E"

Red

Line 3 — "#ED2E38"

Yellow

Line 4 — "#FFD525"

Lilac

Line 5 — "#874ABF"

Silver

Line 15 — "#8F8F8C"

Details

Colors follow official METRO SP and ViaMobilidade branding. Only the six currently operating metro lines are included; CPTM train lines and planned future lines (e.g., Line 6 Orange, Line 17 Gold) are not covered.

See Also

lines for the full line reference (numbers, names, and route geometries).


Passengers Entering Metro SP Stations by Line

Description

Monthly count of passengers entering São Paulo metro stations, aggregated by metro line. Data covers October 2017 through 2026 for Lines 1, 2, 3, and 15; Line 4 from January 2012; Line 5 from October 2017. Sourced from the METRO SP transparency portal and the Insper Dataverse.

Usage

passengers_entrance

Format

A data frame with the following columns:

date

First day of the month (Date).

line_number

Metro line number: 1, 2, 3, 4, 5, 15, or 99 for the network total (integer).

metric_abb

Abbreviated metric code (character). One of: "total", "mdu", "msa", "mdo", "max".

value

Passenger count (numeric).

metric

Measurement type in English (character). One of: "Total", "Average on Business Days", "Average on Saturdays", "Average on Sundays", "Daily Peak".

metric_pt

Measurement type in Portuguese (character). One of: "Total", "Média dos Dias Úteis", "Média dos Sábados", "Média dos Domingos", "Máxima Diária".

line_name

English name of the metro line (character).

line_name_pt

Portuguese name of the metro line (character).

year

Calendar year (integer).

Details

Data by source and line:

  • Lines 1, 2, 3, and 15: METRO SP transparency portal, October 2017–2026.

  • Line 4 (Amarela/ViaQuatro): Insper Dataverse, January 2012–2026.

  • Line 5 (Lilás/ViaMobilidade): METRO SP transparency portal, October 2017–July 2018; Insper Dataverse, August 2018–2026.

  • Network total (line_number = 99): METRO SP transparency portal only; may not be available for all years.

Metrics:

  • total: Total passengers in the month.

  • mdu: Average daily entries on business days (Média dos Dias Úteis).

  • msa: Average daily entries on Saturdays (Média dos Sábados).

  • mdo: Average daily entries on Sundays (Média dos Domingos).

  • max: Daily maximum (Máxima Diária).

Months beyond the last published data point for each line are trimmed during assembly; interior NAs (e.g. operational outages) are preserved.

Source

Companhia do Metropolitano de São Paulo (METRO SP). https://transparencia.metrosp.com.br/dataset/demanda

See Also

passengers_transported for transported counts, station_averages for station-level weekday averages.


Passengers Transported by Metro SP Line

Description

Monthly count of passengers transported by São Paulo metro, aggregated by metro line. Data covers October 2017 through 2026 for Lines 1, 2, 3, and 15, and October 2017 through December 2019 for Line 5. Sourced from the METRO SP transparency portal.

Usage

passengers_transported

Format

A data frame with the following columns:

date

First day of the month (Date).

line_number

Metro line number: 1, 2, 3, 5, 15, or 99 for the network total (integer).

metric_abb

Abbreviated metric code (character). One of: "total", "mdu", "msa", "mdo", "max".

value

Passenger count (numeric).

metric

Measurement type in English (character). One of: "Total", "Average on Business Days", "Average on Saturdays", "Average on Sundays", "Daily Peak".

metric_pt

Measurement type in Portuguese (character). One of: "Total", "Média dos Dias Úteis", "Média dos Sábados", "Média dos Domingos", "Máxima Diária".

line_name

English name of the metro line (character).

line_name_pt

Portuguese name of the metro line (character).

year

Calendar year (integer).

Details

All data comes from the METRO SP transparency portal. Line 4 (Amarela) is not available in this dataset — the Insper Dataverse source does not include transported counts for Lines 4 or 5. Line 5 (Lilás) is available from the METRO portal only for October 2017–December 2019. The network total (line_number = 99) may not be available for all years.

Metrics:

  • total: Total passengers in the month.

  • mdu: Average daily entries on business days (Média dos Dias Úteis).

  • msa: Average daily entries on Saturdays (Média dos Sábados).

  • mdo: Average daily entries on Sundays (Média dos Domingos).

  • max: Daily maximum (Máxima Diária).

Months beyond the last published data point for each line are trimmed during assembly; interior NAs (e.g. operational outages) are preserved.

Source

Companhia do Metropolitano de São Paulo (METRO SP). https://transparencia.metrosp.com.br/dataset/demanda

See Also

passengers_entrance for entry counts, station_averages for station-level weekday averages.


Average Weekday Passenger Entries by Station

Description

Monthly average of weekday (business day) passenger entries for each station in the São Paulo metro system. Data covers October 2017 through 2026 for Lines 1, 2, 3, and 15; Line 4 from January 2012; Line 5 from October 2017. Sourced from the METRO SP transparency portal and the Insper Dataverse.

Usage

station_averages

Format

A data frame with the following columns:

date

First day of the month (Date).

line_number

Metro line number (integer).

station_name

Name of the metro station (character).

avg_passenger

Average weekday passenger entries (numeric).

line_name

English name of the metro line (character).

line_name_pt

Portuguese name of the metro line (character).

year

Calendar year (integer).

Details

Only the weekday average (mdu) metric is available at the station level. For line-level data with all five metrics, see passengers_entrance. Trailing months whose data has not yet been published by the source are excluded (rows with NA values are dropped during assembly).

Station coverage by line and source:

  • Line 1 (Azul/Blue): 23 stations, October 2017–2026 (METRO SP portal).

  • Line 2 (Verde/Green): 14 stations, October 2017–2026 (METRO SP portal).

  • Line 3 (Vermelha/Red): 18 stations, October 2017–2026 (METRO SP portal).

  • Line 4 (Amarela/Yellow): January 2012–2026 (Insper Dataverse).

  • Line 5 (Lilás/Lilac): October 2017–July 2018 (METRO SP portal) and August 2018–2026 (Insper Dataverse).

  • Line 15 (Prata/Silver): 10 stations in 2020, 11 from January 2021 onward (Jardim Colonial added), October 2017–2026 (METRO SP portal).

Source

Companhia do Metropolitano de São Paulo (METRO SP). https://transparencia.metrosp.com.br/dataset/demanda

See Also

station_daily for daily station entries, passengers_entrance for monthly line-level totals.


Daily Passenger Entries by Metro SP Station

Description

Daily passenger entries at each station in the São Paulo metro system. Data covers January 2012 through 2026 for Lines 4 and 5 (Insper Dataverse), and 2020 through 2026 for Lines 1, 2, 3, and 15 (METRO SP transparency portal).

Usage

station_daily

Format

A data frame with the following columns:

date

Date of observation (Date).

line_number

Metro line number: 1, 2, 3, 4, 5, or 15 (integer).

station_name

Full station name (character).

passengers

Daily passenger entries (numeric).

line_name

English name of the metro line (character).

line_name_pt

Portuguese name of the metro line (character).

station_code

Three-letter station abbreviation used internally by METRO SP (character). NA for Lines 4 and 5 (Dataverse source).

year

Calendar year (integer).

Details

Station coverage and date range by line:

  • Line 1 (Azul/Blue): 23 stations, 2020–2026 (METRO SP portal).

  • Line 2 (Verde/Green): 14 stations, 2020–2026 (METRO SP portal).

  • Line 3 (Vermelha/Red): 18 stations, 2020–2026 (METRO SP portal).

  • Line 4 (Amarela/Yellow): January 2012–2026 (Insper Dataverse); station_code is NA.

  • Line 5 (Lilás/Lilac): August 2018–2026 (Insper Dataverse); station_code is NA.

  • Line 15 (Prata/Silver): 10 stations in 2020, 11 from 2021 onward (Jardim Colonial added), 2020–2026 (METRO SP portal).

Some stations appear on multiple lines (e.g., Ana Rosa on Lines 1 and 2, Paraíso on Lines 1 and 2, Sé on Lines 1 and 3). These are recorded separately for each line. Days beyond the last published data point for each line are trimmed during assembly; interior NAs (e.g. operational outages) are preserved.

Source

Companhia do Metropolitano de São Paulo (METRO SP). https://transparencia.metrosp.com.br/dataset/demanda

See Also

station_averages for monthly weekday averages, passengers_entrance for monthly line-level totals.


Station Commercial Opening Dates

Description

Inauguration (commercial opening) dates for São Paulo metro stations, covering stations whose opening falls within or near the station_daily / station_averages window. Used to flag ramp-up periods in which monthly ridership is still climbing toward steady-state and should generally be excluded from year-on-year or baseline comparisons.

Usage

station_inauguration

Format

A data frame with one row per (line, station):

line_number

Metro line number (integer).

station_name

Full station name (character).

inauguration_date

Date of commercial opening (Date). NA for stations whose opening predates the dataset window (i.e., they were already operating when the data record begins).

phase

Short label identifying the expansion phase, e.g. "L15 Fase 4" (character).

verified

Whether the inauguration date has been cross-checked against the operator's announcement or an equivalently reliable source (logical). Stations with verified = FALSE carry best-effort dates and should not be relied on for legal or publication purposes without re-checking.

notes

Free-text annotations about the source or any caveats (character, possibly NA).

pre_data_window

TRUE when inauguration_date is NA because the station opened before the data starts (logical).

ramp_up_end

inauguration_date + 180 days — a heuristic end of the initial ramp-up period (Date). NA when pre_data_window is TRUE.

Details

The table is assembled by data-raw/build_station_inauguration.R from data-raw/station_inauguration.csv. To extend the table or verify uncertain dates, edit the CSV (setting verified = TRUE once cross-checked) and re-run the build script.

Suggested use: when computing pre/post comparisons (e.g.\ 12m-vs-prior-12m or recovery-vs-2019), exclude stations where either window overlaps ramp_up_end to avoid mistaking ramp-up growth for organic demand change.

Source

Compiled from operator announcements (Companhia do Metropolitano de São Paulo, ViaQuatro, ViaMobilidade).

See Also

stations for spatial point locations, station_averages for monthly weekday averages.


Metro and Train Station Locations

Description

Spatial point locations for São Paulo metro (METRO SP) and commuter train (CPTM) stations, including both currently operating stations and planned future stations.

Usage

stations

Format

An sf data frame with POINT geometry (CRS: WGS84 / EPSG:4326) and the following columns:

station_name

Station name in title case (character).

line_number

Line number the station belongs to (integer).

line_name_pt

Portuguese color name of the line (character).

line_name

English color name of the line (character).

company_name

Operating company name (character).

type

Either "metro" (METRO SP) or "train" (CPTM) (character).

status

Either "current" (operating) or "future" (planned expansion) (character).

geometry

Station location (sfc_POINT).

Details

Requires the sf package to work with spatial features. The distinction between types follows GeoSampa's classification. Broadly, "metro" lines run underground as a subway and "train" lines run above ground as commuter rail, though exceptions exist.

Source

GeoSampa, Prefeitura de São Paulo. https://geosampa.prefeitura.sp.gov.br/

See Also

lines for line route geometries, station_averages for passenger data by station.