Installation
You can install the development version of phscs from
GitHub using the pak package:
# install.packages("pak")
pak::pak("yng-me/phscs")Philippine Standard Geographic Code (PSGC)
One of the main functions in the phscs package is
get_psgc(), which retrieves the Philippine Standard
Geographic Code (PSGC) data. This function allows you to specify
various parameters such as the version, level of geographic data, and
whether to harmonize or minimize the dataset.
# Retrieve PSGC data
psgc_data <- get_psgc()
psgc_data |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")You can also retrieve data for specific levels, such as regions, provinces, municipalities, and barangays.
psgc_provinces <- get_psgc(level = "provinces")
psgc_regions <- get_psgc(level = "regions")
psgc_regions |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")| area_code | area_code_old | area_name |
|---|---|---|
| 0100000000 | 010000000 | Region I (Ilocos Region) |
| 0200000000 | 020000000 | Region II (Cagayan Valley) |
| 0300000000 | 030000000 | Region III (Central Luzon) |
| 0400000000 | 040000000 | Region IV-A (CALABARZON) |
| 0500000000 | 050000000 | Region V (Bicol Region) |
| 0600000000 | 060000000 | Region VI (Western Visayas) |
| 0700000000 | 070000000 | Region VII (Central Visayas) |
| 0800000000 | 080000000 | Region VIII (Eastern Visayas) |
| 0900000000 | 090000000 | Region IX (Zamboanga Peninsula) |
| 1000000000 | 100000000 | Region X (Northern Mindanao) |
You can also filter the data using dplyr syntax. For
example, to get all areas in the region with code “10”:
# Retrieve PSGC data for areas in region 10
psgc_region_10 <- get_psgc(grepl("^10", area_code))
psgc_region_10 |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")| area_code | area_code_old | area_name |
|---|---|---|
| 1000000000 | 100000000 | Region X (Northern Mindanao) |
| 1001300000 | 101300000 | Bukidnon |
| 1001301000 | 101301000 | Baungon |
| 1001301001 | 101301001 | Balintad |
| 1001301002 | 101301002 | Buenavista |
| 1001301003 | 101301003 | Danatag |
| 1001301004 | 101301004 | Kalilangan |
| 1001301005 | 101301005 | Lacolac |
| 1001301006 | 101301006 | Langaon |
| 1001301007 | 101301007 | Liboran |
You can also retrieve the full PSGC dataset with all available
columns by setting minimal = FALSE or by specifying
additional columns to include:
# Retrieve full PSGC data
psgc_full_data <- get_psgc(minimal = FALSE)
# Retrieve PSGC data with additional columns
psgc_data_with_cols <- get_psgc(
cols = c(
"area_code",
"area_name",
"region_code",
"province_code"
)
)
psgc_data_with_cols |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")| area_code | area_code_old | area_name | region_code | province_code |
|---|---|---|---|---|
| 0100000000 | 010000000 | Region I (Ilocos Region) | 01 | 000 |
| 0102800000 | 012800000 | Ilocos Norte | 01 | 028 |
| 0102801000 | 012801000 | Adams | 01 | 028 |
| 0102801001 | 012801001 | Adams | 01 | 028 |
| 0102802000 | 012802000 | Bacarra | 01 | 028 |
| 0102802001 | 012802001 | Bani | 01 | 028 |
| 0102802002 | 012802002 | Buyon | 01 | 028 |
| 0102802003 | 012802003 | Cabaruan | 01 | 028 |
| 0102802004 | 012802004 | Cabulalaan | 01 | 028 |
| 0102802005 | 012802005 | Cabusligan | 01 | 028 |
Philippine Standard Industrial Classification (PSIC)
The get_psic() function retrieves the Philippine Standard
Industrial Classification (PSIC) data. You can specify the level of
detail you want, such as sections or divisions.
# Retrieve PSIC data
psic_data <- get_psic()
# Retrieve PSIC data for specific levels
psic_sections <- get_psic(level = "sections")
psic_sections |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")| value | label |
|---|---|
| A | Agriculture, forestry and fishing |
| B | Mining and quarrying |
| C | Manufacturing |
| D | Electricity, gas, steam and air conditioning supply |
| E | Water supply; sewerage, waste management |
| F | Construction |
| G | Wholesale and retail trade; repair of motor vehicles and motorcycles |
| H | Transportation and storage |
| I | Accommodation and food service activities |
| J | Information and communication |
Philippine Standard Occupational Classification (PSOC)
The get_psoc() function retrieves the Philippine Standard
Occupational Classification (PSOC) data. Similar to PSIC, you can
specify the level of detail you want.
# Retrieve PSOC data
psoc_data <- get_psoc()
# Retrieve PSOC data for specific levels
psoc_major <- get_psoc(level = "major")
psoc_major |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")| value | label |
|---|---|
| 1 | Managers |
| 2 | Professionals |
| 3 | Technicians and associate professionals |
| 4 | Clerical support workers |
| 5 | Service and sales workers |
| 6 | Skilled agricultural, forestry and fishery workers |
| 7 | Craft and related trades workers |
| 8 | Plant and machine operators, and assemblers |
| 9 | Elementary occupations |
| 0 | Armed forces occupations |
Philippine Standard Classification for Education (PSCED)
The get_psced() function retrieves the Philippine Standard
Classification for Education (PSCED) data. You can specify the level
of detail you want, such as broadfield or narrowfield.
# Retrieve PSCED data
psced_data <- get_psced()
psced_data |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")| value | label |
|---|---|
| 01000 | Early Childhood Educational Development Programs |
| 02000 | Pre-Primary Education Programs (Kindergarten) |
| 10001 | Primary Education Programs |
| 10002 | Inclusive and Special Needs Education Programs |
| 10003 | Continuing / Second-Chance Education Programs |
| 24001 | Lower Secondary Education Programs |
| 24002 | Inclusive and Special Needs Education Programs |
| 24003 | Continuing / Second-Chance Education Programs |
| 25000 | Lower Secondary Technical-Vocational Livelihood Programs (Junior High School) |
| 34001 | Academic Track |
You can also retrieve data for specific levels, such as
broadfield or narrowfield:
# Retrieve PSCED data for specific levels
psced_broadfield <- get_psced(level = "broadfield")
psced_broadfield |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")| value | label |
|---|---|
| 01 | Early Childhood Educational Development Programs |
| 02 | Pre-Primary Education Programs (Kindergarten) |
| 10 | Primary Education Programs (Elementary) |
| 24 | Lower Secondary General Education Programs (Junior High School) |
| 25 | Lower Secondary Technical-Vocational Livelihood Programs (Junior High School) |
| 34 | Upper Secondary General Education Programs (Senior High School: Grade 11 And Grade 12) |
| 35 | Upper Secondary Vocational Education Programs (Senior High School: Grade 11 And Grade 12) |
| 40 | Generic Programmes and Qualifications |
| 41 | Services |
| 49 | Field Unknown |
Philippine Classification of Individual Consumption According to Purpose (PCOICOP)
The get_pcoicop() function retrieves the Philippine
Classification of Individual Consumption According to Purpose
(PCOICOP) data. You can specify the level of detail you want, such as
divisions or groups.
# Retrieve PCOICOP data
pcoicop_data <- get_pcoicop()
pcoicop_data |>
head(10) |>
gt::gt() |>
gt::tab_options(table.align = "left")| value | label |
|---|---|
| 01 | Food and non-alcoholic beverages |
| 02 | Alcoholic beverages, tobacco and narcotics |
| 03 | Clothing and footwear |
| 04 | Housing, water, electricity, gas and other fuels |
| 05 | Furnishings, household equipment and routine household maintenance |
| 06 | Health |
| 07 | Transport |
| 08 | Information and communication |
| 09 | Recreation, sport and culture |
| 10 | Education services |