Type: Package
Title: Philippine Statistical Classification Systems
Version: 0.1.0
Description: A unified interface to access and manipulate various Philippine statistical classifications. It allows users to retrieve, filter, and harmonize classification data, making it easier to work with Philippine statistical data in R.
Author: Bhas Abdulsamad ORCID iD [aut, cre, cph]
Maintainer: Bhas Abdulsamad <aeabdulsamad@gmail.com>
License: MIT + file LICENSE
Encoding: UTF-8
Imports: purrr (≥ 1.0.2), jsonlite (≥ 1.8.8), dplyr (≥ 1.1.0), tidyr (≥ 1.3.1), stringr (≥ 1.4.0)
Suggests: rlang (≥ 1.0.2), testthat (≥ 3.0.0), utils (≥ 4.0.0), cli, gt, rmarkdown, knitr
Config/testthat/edition: 3
RoxygenNote: 7.3.3
Depends: R (≥ 4.1.0)
VignetteBuilder: knitr
BugReports: https://github.com/yng-me/phscs/issues
URL: https://yng-me.github.io/phscs/, https://github.com/yng-me/phscs
NeedsCompilation: no
Packaged: 2025-11-05 17:03:05 UTC; bhasabdulsamad
Repository: CRAN
Date/Publication: 2025-11-09 16:40:02 UTC

Philippine Classification of Individual Consumption According to Purpose (PCOICOP)

Description

Philippine Classification of Individual Consumption According to Purpose (PCOICOP)

Usage

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

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.

version

Character. Version of the PCOICOP to retrieve. Default is NULL. If NULL, the latest version is used.

level

Character. Level of detail to retrieve. Options are "all", "divisions", "groups", "class", "sub-class", "item", and "subitem".

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.

Value

A tibble containing the requested PCOICOP data.

References

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

Examples

## Not run: 
get_pcoicop(token = "your_api_token")

## End(Not run)
# If token is not provided, the function will fetch from local cache or
# download the latest version from remote repo
pcoicop <- get_pcoicop()

# Get specific level
pcoicop_filtered <- get_pcoicop(level = "divisions")
pcoicop_filtered

Philippine Central Product Classification (PCPC)

Description

Philippine Central Product Classification (PCPC)

Usage

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

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.

version

Character. Version of the PCPC to retrieve. Default is NULL. If NULL, the latest version is used.

level

Character. Level of detail to retrieve. Options are "all", "sections", "divisions", "groups", "classes", "sub-classes", and "item".

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.

Value

A tibble containing the requested PCPC data.

References

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

Examples

## Not run: 
get_pcpc(token = "your_api_token")

## End(Not run)

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

# Get specific level
pcpc_filtered <- get_pcpc(level = "sections")
pcpc_filtered

Philippine Standard Classification of Education (PSCED)

Description

Philippine Standard Classification of Education (PSCED)

Usage

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

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.

version

Character. Version of the PSCED dataset. Default is NULL. If NULL, the latest version is used.

level

Character. Classification levels such as "all", "levels", "broadfield", "narrowfield", and "detailedfield". Default is "detailedfield".

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.

Value

A data frame of PSCED classifications.

References

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

Examples

## Not run: 
get_psced(token = "your_api_token")

## End(Not run)
# If token is not provided, the function will fetch from local cache or
# download the latest version from remote repo
psced <- get_psced()

# Get specific level
psced_filtered <- get_psced(level = "levels")
psced_filtered

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
)

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.

Value

A data frame of PSGC geographic data.

References

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

Examples

## Not run: 
get_psgc(token = "your_api_token")

## End(Not run)

# 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


Philippine Standard Industrial Classification (PSIC)

Description

Philippine Standard Industrial Classification (PSIC)

Usage

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

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.

version

Character. Version of the PSIC dataset. Default is NULL. If NULL, the latest version is used.

level

Character. Classification level such as "all", "sections", "divisions", "groups", "classes", and "sub-classes".

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.

Value

A data frame of PSIC classifications.

References

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

Examples

## Not run: 
get_psic(token = "your_api_token")

## End(Not run)
# If token is not provided, the function will fetch from local cache or
# download the latest version from remote repo
psic <- get_psic()

# Get specific level
psic_filtered <- get_psic(level = "sections")
psic_filtered

Philippine Standard Occupational Classification (PSOC)

Description

Philippine Standard Occupational Classification (PSOC)

Usage

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

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.

version

Character. Version of the PSOC dataset. Default is NULL. If NULL, the latest version is used.

level

Character. Classification level such as "all", "major", "sub-major", "minor", and "unit".

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.

Value

A data frame of PSOC classifications.

References

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

Examples

## Not run: 
get_psoc(token = "your_api_token")

## End(Not run)
# If token is not provided, the function will fetch from local cache or
# download the latest version from remote repo
psoc <- get_psoc()

# Get specific level
psoc_filtered <- get_psoc(level = "major")
psoc_filtered


Shorten region name

Description

This function shortens the region names in a PSGC data frame.

Usage

shorten_region_name(data, which = c("label", "number"), col = "area_name")

Arguments

data

A data frame containing PSGC data.

which

Character. Specifies whether to shorten the region name by label or number. Options are "label" or "number".

col

Character. The name of the column containing the area names. Default is "area_name".

Value

A data frame with the region names shortened based on the specified which argument.

Examples

regions <- get_psgc(level = "regions")
shorten_region_name(regions)
shorten_region_name(regions, which = "number")