Skip to contents

Installation

Install pkmapr from GitHub:

remotes::install_github("abdullahumer1101/pkmapr")

Or:

# install.packages("pkmapr", repos = "https://abdullahumer1101.r-universe.dev")

Your first map

Get province boundaries and create a quick map:

provinces <- get_provinces()
pk_map(provinces)

Look up names before joining

Always check official names before filtering or joining:

# All provinces with their codes
pk_dictionary("provinces")

# Districts in Punjab
pk_dictionary("districts", province = "Punjab")

# Tehsils in Lahore district
pk_dictionary("tehsils", district = "Lahore")

Join your own data

library(dplyr)

# Example: district-level data
my_data <- data.frame(
  district_code = c("PK603", "PK604"),
  value = c(42, 37)
)

districts <- get_districts() |>
  pk_join(my_data, by = "district_code")

# Map the result
pk_map(districts, fill = "value", title = "My Values")

Interactive maps

pk_map_interactive(districts, 
                    fill = "value",
                    popup = c("district_name", "value"))

Next steps