R: return sizes of an object whether it is a vector, matrix or...

nimDim {nimble} | R Documentation

## return sizes of an object whether it is a vector, matrix or array

### Description

R's regular `dim` function returns NULL for a vector. It is useful to have this function that treats a vector similarly to a matrix or array. Works in R and NIMBLE. In NIMBLE `dim` is identical to `nimDim`, not to R's `dim`

### Usage

    nimDim(obj)

### Arguments

`obj` | objects for which the sizes are requested

### Value

a vector of sizes in each dimension

### Author(s)

NIMBLE development team

### Examples

    x <- rnorm(4)
    dim(x)
    nimDim(x)
    y <- matrix(x, nrow = 2)
    dim(y)
    nimDim(y)

[Package nimble version 0.9.1 Index]