View source: R/CST_ReorderDims.R
| CST_ReorderDims | R Documentation |
Reorder the dimensions of an s2dv_cube. The order can be provided either as indices or the dimension names. If the order is dimension names, the function looks for names(dim(x)). If it doesn't exist, the function checks if attributes "dimensions" exists; this attribute is in the objects generated by Load().
CST_ReorderDims(x, order)
x |
An array of which the dimensions to be reordered. |
order |
A vector of indices or character strings indicating the new order of the dimensions. |
An s2dv_cube which has the data and information as parameter 'x', but with different dimension order.
Reorder
# Example with sample data:
# Check original dimensions and coordinates
lonlat_temp$exp$dims
names(lonlat_temp$exp$coords)
# Reorder the s2dv_cube
new_order <- c("dataset", "member", "sdate", "ftime", "lon", "lat")
res <- CST_ReorderDims(x = lonlat_temp$exp, order = new_order)
# Check new dimensions and coordinates
dim(res$data)
res$dims
names(res$coords)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.