From 581e1e2d8300fbd1328eed23f7517b3dfa7d5997 Mon Sep 17 00:00:00 2001 From: soriadelva <158742062+soriadelva@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:25:20 +0200 Subject: [PATCH] Add sf:: to necessary commands --- R/calculate_polygon_centroid.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/calculate_polygon_centroid.R b/R/calculate_polygon_centroid.R index a96b89a..25db9ff 100644 --- a/R/calculate_polygon_centroid.R +++ b/R/calculate_polygon_centroid.R @@ -110,8 +110,8 @@ calculate_polygon_centroid <- function(sf_df, id){ }else{ ### split the polygons into vertrex points #### sf_df_sub <- sf_df_sub %>% - st_cast("MULTIPOINT") %>% - st_cast("POINT", do_split = TRUE) + sf::st_cast("MULTIPOINT") %>% + sf::st_cast("POINT", do_split = TRUE) ### Check if the number of points is equal to the number of vertices #### if(nrow(sf_df_sub) != unique(sf_df_sub$NbrVertex)){ @@ -129,7 +129,7 @@ calculate_polygon_centroid <- function(sf_df, id){ warning(paste0("no centroid for ", u)) } ### Calculate the distance #### - distance <- st_distance(sf_df_sub, centroids_sub) %>% + distance <- sf::st_distance(sf_df_sub, centroids_sub) %>% units::drop_units() ### Calculate the maximum distance ####