Learn R Programming

phscs (version 0.1.0)

get_psgc: Philippine Standard Geographic Code (PSGC)

Description

Philippine Standard Geographic Code (PSGC)

Usage

get_psgc(
  ...,
  token = NULL,
  version = NULL,
  level = NULL,
  harmonize = TRUE,
  minimal = TRUE,
  cols = NULL
)

Value

A data frame of PSGC geographic data.

Arguments

...

See ?dplyr::filter. Expressions that return a logical value, and are defined in terms of the variables in returned data. If multiple expressions are included, they are combined with the & operator. Only rows for which all conditions evaluate to TRUE are kept.

token

Character. API access token. If NULL, retrieves data from the local cache.

version

Character. PSGC version such as: "Q3_2025", "July_2025", "Q2_2025", "Q1_2025", "April_2024", "Q4_2024", "Q3_2024", "Q2_2024", and "Q4_2023", "Q2_2021". If NULL, retrieves the latest version available in the local cache.

level

Character. Level of geographic data to retrieve. Available options are: "all", "regions", "provinces", "hucs" "municipalities", "sub_municipalities" "barangays", "income_classification", "urban_rural", and "city_class".

harmonize

Logical. If TRUE, formats and standardizes the returned data. Default is TRUE.

minimal

Logical. If TRUE, returns a simplified dataset. Default is TRUE.

cols

Optional. Character vector of additional columns to include when minimal = FALSE.

References

https://psa.gov.ph/classification/psgc

Examples

Run this code
if (FALSE) {
get_psgc(token = "your_api_token")
}

# If token is not provided, the function will fetch from local cache or
# download the latest version from remote repo
psgc <- get_psgc()

# Get specific level
psgc_regions <- get_psgc(level = "regions")
psgc_regions

Run the code above in your browser using DataLab