From 6f45539901cc737b80b4fa2da32905c4955b4590 Mon Sep 17 00:00:00 2001 From: rhijmans Date: Tue, 1 Oct 2024 13:42:08 -0700 Subject: [PATCH] m --- R/names.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/names.R b/R/names.R index 904019c7f..032fb27e3 100644 --- a/R/names.R +++ b/R/names.R @@ -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") } @@ -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))