Skip to content

Commit

Permalink
Make data frame without sf
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Oct 11, 2023
1 parent 327964a commit 6523df4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions R/get_eurostat_geospatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#' © EuroGeographics for the administrative boundaries
#'
#' Data downloaded using \pkg{giscoR}
#'
#'
#' @inheritSection eurostat-package Eurostat: Copyright notice and free re-use of data
#' @inheritSection eurostat-package Data source: GISCO - General Copyright
#' @inheritSection eurostat-package Data source: GISCO - Administrative Units / Statistical Units
Expand Down Expand Up @@ -233,8 +233,15 @@ get_eurostat_geospatial <- function(output_class = "sf",
# nocov start
if (!requireNamespace("sf", quietly = TRUE)) {
# Remove geometry without sf package
shp$geometry <- NULL
# nocov end

new_class <- intersect(class(shp), class(tibble::tibble()))
geom_col <- attr(shp, "sf_column")

# Unclass and remove specific sf columns
class(shp) <- new_class

shp <- shp[, setdiff(names(shp), geom_col)]
# nocov end
} else {
# Remove geometry
shp <- sf::st_drop_geometry(shp)
Expand Down

0 comments on commit 6523df4

Please sign in to comment.