From 0c9712d105b366c229b3a9c1d6259120a89c5b66 Mon Sep 17 00:00:00 2001 From: Charlotte Soneson Date: Fri, 13 Nov 2026 16:56:32 +0100 Subject: [PATCH] Always extract last two dimensions (for x and y) in extent() Co-authored-by: Michael Stadler Co-authored-by: Charlotte Soneson --- R/extent.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/extent.R b/R/extent.R index a9115405..58af3303 100644 --- a/R/extent.R +++ b/R/extent.R @@ -39,7 +39,7 @@ setMethod("extent", "SpatialDataArray", \(x, i=1) { x <- transform(x, i) wh <- metadata(x)$wh %||% { n <- length(d <- dim(x)) - if (n == 3) d <- d[-1] + d <- d[(n - 1):n] d <- rev(d) lapply(d, \(.) c(0, .)) }