drop_dim | R Documentation |
This function removes a specified dimension from a given object, such as a matrix or an array.
drop_dim(x, dimnum)
## S4 method for signature 'AxisSet2D,numeric'
drop_dim(x, dimnum)
## S4 method for signature 'AxisSet2D,missing'
drop_dim(x, dimnum)
## S4 method for signature 'AxisSet3D,numeric'
drop_dim(x, dimnum)
## S4 method for signature 'AxisSet3D,missing'
drop_dim(x, dimnum)
## S4 method for signature 'NeuroSpace,numeric'
drop_dim(x, dimnum)
## S4 method for signature 'NeuroSpace,missing'
drop_dim(x)
x |
A dimensioned object, such as a NeuroSpace object. |
dimnum |
An integer representing the index of the dimension to drop. |
An updated dimensioned object with the specified dimension removed.
# Create a NeuroSpace object with dimensions (10, 10, 10)
x <- NeuroSpace(c(10, 10, 10), c(1, 1, 1))
# Drop the first dimension
x1 <- drop_dim(x, 1)
# Check the new dimensions
ndim(x1) == 2
dim(x1)[1] == 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.