# Author: Babak Naimi, naimi.b@gmail.com
# Date : Feb. 2024
# Last Update : Feb. 2024
# Version 1.0
# Licence GPL v3
#---------------------
setMethod('names', signature(x='stcube'),
function(x) {
if (x@format == 'tseq') names(x@cube)
else names(x@cube[1])
}
)
#----------
setReplaceMethod('names', signature(x='stcube'),
function(x,value) {
if (!is.character(value)) stop('value should be a character vector')
if (x@format == 'tseq') {
if (length(x@cube) != length(value)) stop(paste0('The length of names character is not equalt to the number of variables (',length(x@cube),') in the spatio-temporal cube!'))
names(x@cube) <- value
} else {
if (length(x@cube[1]) != length(value)) stop(paste0('The length of names character is not equalt to the number of variables (',length(x@cube[1]),') in the spatio-temporal cube!'))
for (i in 1:length(x@cube)) {
names(x@cube[i]) <- value
}
}
x
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.