Skip to content

Commit 108904a

Browse files
committed
Refactored inspire_grid.character argument order for clarity and updated documentation.
1 parent 5147273 commit 108904a

2 files changed

Lines changed: 29 additions & 26 deletions

File tree

R/inspire_grid.R

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -331,27 +331,27 @@ inspire_grid.matrix <- function(
331331
#' @rdname inspire_grid
332332
inspire_grid.character <- function(
333333
x,
334-
# Relevant arguments (passed to inspire_grid_from_ids)
335-
crs = NULL,
336-
point_type = "centroid",
337-
output_type = "sf_polygons",
338-
include_llc = TRUE,
339-
id_format = "both",
340-
axis_order = "NE",
341-
quiet = FALSE,
342-
dsn = NULL,
343-
layer = NULL,
344-
# Irrelevant arguments (sink these to prevent them from entering '...')
345-
cellsize_m = NULL,
346-
clip_to_input = FALSE,
347-
use_convex_hull = FALSE,
348-
buffer_m = 0,
349-
parallel = "auto",
350-
max_memory_gb = NULL,
351-
# Everything else (e.g., backend options for st_write)
334+
# --- Must match Generic Order Exactly ---
335+
cellsize_m = NULL, # Ignored (Sink)
336+
crs = NULL, # Used
337+
output_type = "sf_polygons", # Used
338+
clip_to_input = FALSE, # Ignored (Sink)
339+
use_convex_hull = FALSE, # Ignored (Sink)
340+
buffer_m = 0, # Ignored (Sink)
341+
id_format = "both", # Used
342+
axis_order = "NE", # Used
343+
include_llc = TRUE, # Used
344+
point_type = "centroid", # Used
345+
parallel = "auto", # Ignored (Sink)
346+
quiet = FALSE, # Used
347+
dsn = NULL, # Used
348+
layer = NULL, # Used
349+
max_memory_gb = NULL, # Ignored (Sink)
352350
...
353351
) {
354-
# Warn if user provided irrelevant arguments
352+
353+
# 1. Guardrails: Warn if specific ignored arguments are provided
354+
# Note: We check if they are explicitly non-NULL/TRUE, distinct from defaults
355355
if (!is.null(cellsize_m) || isTRUE(clip_to_input) ||
356356
isTRUE(use_convex_hull) || buffer_m != 0 || parallel != "auto" ||
357357
!is.null(max_memory_gb)) {
@@ -362,6 +362,9 @@ inspire_grid.character <- function(
362362
)
363363
}
364364

365+
# 2. Call the internal function
366+
# We explicitly pass the *relevant* arguments found above.
367+
# We do NOT pass the *ignored* arguments (like cellsize_m).
365368
inspire_grid_from_ids(
366369
ids = x,
367370
crs = crs,

man/inspire_grid.Rd

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)