Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fnsd

First non-singleton dimension


Description

Given an array, returns the first non-singleton dimension. Useful for emulating some of Matlab / Octave's multidimensional functions.

If n is supplied, return the first n nonsingleton dimensions.

Usage

fnsd(a,n)

Arguments

a

An array

n

Integer. Return the first n nonsingleton dimensions

Value

Returns an integer vector with elements in the range 1 to length(dim(a)).

Note

Treats zero-extent dimensions as singletons.

Case n=0 now treated sensibly (returns a zero-length vector).

Author(s)

Robin K. S. Hankin

See Also

Examples

a <- array(1:24,c(1,1,1,1,2,1,3,4))
fnsd(a)
fnsd(a,2)

magic

Create and Investigate Magic Squares

v1.5-9
GPL-2
Authors
Robin K. S. Hankin
Initial release
2018-09-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.