MergeDims {CSTools}R Documentation

Function to Split Dimension

Description

This function merges two dimensions of an array 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

MergeDims(
  data,
  merge_dims = c("time", "monthly"),
  rename_dim = NULL,
  na.rm = FALSE
)

Arguments

data

an n-dimensional array with named dimensions

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 merge_dims will be used.

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 : 20
dim(data) <- c(time = 10, lat = 2)
new_data <- MergeDims(data, merge_dims = c('time', 'lat'))

[Package CSTools version 4.0.1 Index]