Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Oct 1, 2024
1 parent 05ca6e0 commit 6f45539
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/names.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ setMethod("names<-", signature(x="SpatRasterDataset"),
}
if (is.list(value)) {
nl <- nlyr(x)
if (lenght(value) == 1) {
if (length(value) == 1) {
if (length(unique(nl)) > 1) {
error("names<-", "the number of layers varies between datasets")
}
Expand All @@ -116,7 +116,7 @@ setMethod("names<-", signature(x="SpatRasterDataset"),
if (length(value) != length(x)) {
error("names<-", "the number of list elements does not match the number of datasets")
}
for (i in seq_along(length(x))) x@ptr$set_layernames(enc2utf8(as.character(value[[i]]), i-1))
for (i in seq_along(length(x))) x@ptr$set_layernames(enc2utf8(as.character(value[[i]])), i-1)
}
} else {
x@ptr$names <- enc2utf8(as.character(value))
Expand Down

0 comments on commit 6f45539

Please sign in to comment.