Skip to content

Commit

Permalink
Expose .name_repair arg from as_tibble()
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed Oct 9, 2024
1 parent e30117f commit 15d9a50
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/sf_to_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ sf_to_df <- function(x,
#' @param y A sf object passed as y argument to [dplyr::left_join()].
#' @param by A character vector of variables to join by passed to
#' [dplyr::left_join()].
#' @param as_tibble If `TRUE`, use [tibble::as_tibble()] to make sure a sf
#' tibble is returned.
#' @param .name_repair Passed to [tibble::as_tibble()].
#' @inheritParams rlang::args_error_context
#' @seealso
#' [ggspatial::df_spatial()]
Expand All @@ -85,6 +88,7 @@ df_to_sf <- function(x,
by = NULL,
...,
as_tibble = TRUE,
.name_repair = "unique",
call = caller_env()) {
check_data_frame(x, call = call)

Expand Down Expand Up @@ -124,7 +128,7 @@ df_to_sf <- function(x,
)

if (as_tibble && !is_tibble(x)) {
x <- sf::st_as_sf(as_tibble(x))
x <- sf::st_as_sf(as_tibble(x, .name_repair = .name_repair))
}

st_transform_ext(x = x, crs = crs, class = "sf")
Expand Down

0 comments on commit 15d9a50

Please sign in to comment.