CST_MergeDims {CSTools} | R Documentation |
Function to Merge Dimensions
Description
This function merges two dimensions of the array data
in a
's2dv_cube' object into one. The user can select the dimensions to merge and
provide the final name of the dimension. The user can select to remove NA
values or keep them.
Usage
CST_MergeDims(
data,
merge_dims = c("ftime", "monthly"),
rename_dim = NULL,
na.rm = FALSE
)
Arguments
data |
An 's2dv_cube' object |
merge_dims |
A character vector indicating the names of the dimensions to merge. |
rename_dim |
a character string indicating the name of the output
dimension. If left at NULL, the first dimension name provided in parameter
|
na.rm |
A logical indicating if the NA values should be removed or not. |
Author(s)
Nuria Perez-Zanon, nuria.perez@bsc.es
Examples
data <- 1 : c(2 * 3 * 4 * 5 * 6 * 7)
dim(data) <- c(time = 7, lat = 2, lon = 3, monthly = 4, member = 6,
dataset = 5, var = 1)
data[2,,,,,,] <- NA
data[c(3,27)] <- NA
data <- list(data = data)
class(data) <- 's2dv_cube'
new_data <- CST_MergeDims(data, merge_dims = c('time', 'monthly'))
new_data <- CST_MergeDims(data, merge_dims = c('lon', 'lat'), rename_dim = 'grid')
new_data <- CST_MergeDims(data, merge_dims = c('time', 'monthly'), na.rm = TRUE)
[Package CSTools version 5.2.0 Index]