Skip to content

Commit

Permalink
md
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Jan 27, 2023
1 parent 7f4dde7 commit f2f4007
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ setMethod("rangeFill", signature(x="SpatRaster"),

setMethod("metadata", signature(x="SpatRaster"),
function(x) {
x <- x@ptr$metadata
f <- function(i) {
matrix(unlist(regmatches(i, regexpr("=", i), invert=TRUE)), ncol=2, byrow=TRUE)
if (length(i) == 0) {
matrix(ncol=2, nrow=0)
} else {
matrix(unlist(regmatches(i, regexpr("=", i), invert=TRUE)), ncol=2, byrow=TRUE)
}
}
lapply(x, f)
lapply(x@ptr$metadata, f)
}
)

Expand Down

0 comments on commit f2f4007

Please sign in to comment.