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 5.2.0 Index]