From 527e7395341b83f06d370a2a4bea3977474f486a Mon Sep 17 00:00:00 2001 From: Paolo Di Lorenzo Date: Thu, 12 Jun 2025 23:22:33 -0400 Subject: [PATCH] Set as_tibble to false in read_sf calls --- NEWS.md | 3 +++ R/create-us-map.R | 2 +- R/us-map.R | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 7c34bac..3453040 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # [unreleased] +* Change output of `us_map()` and `centroid_labels()` to data frame instead of tibble. + * If `tibble` format is required use `tibble:as_tibble()`. + # usmapdata 0.5.0 Released Thursday, May 22, 2025. diff --git a/R/create-us-map.R b/R/create-us-map.R index 2c9512d..674fde7 100644 --- a/R/create-us-map.R +++ b/R/create-us-map.R @@ -60,7 +60,7 @@ create_us_map <- function( type <- match.arg(type) # import map file - us <- sf::read_sf(input_file) + us <- sf::read_sf(input_file, as_tibble = FALSE) # ea: US National Atlas Equal Area us_ea <- sf::st_transform(us, ea_crs()) diff --git a/R/us-map.R b/R/us-map.R index 3e6d8ea..bd34b26 100644 --- a/R/us-map.R +++ b/R/us-map.R @@ -51,7 +51,7 @@ us_map <- function( map_year <- select_map_year(data_year) file_name <- paste0("us_", regions, ".gpkg") file_path <- system.file("extdata", map_year, file_name, package = "usmapdata") - df <- sf::read_sf(file_path) + df <- sf::read_sf(file_path, as_tibble = FALSE) if (length(include) > 0) { df <- df[df$full %in% include | @@ -91,7 +91,7 @@ centroid_labels <- function( file_name <- paste0("us_", regions, "_centroids.gpkg") file_path <- system.file("extdata", map_year, file_name, package = "usmapdata") - sf::read_sf(file_path) + sf::read_sf(file_path, as_tibble = FALSE) } #' Years for which US map data is available