numel: Number of elements (GNU Octave/MATLAB compatible)

numelR Documentation

Number of elements (GNU Octave/MATLAB compatible)

Description

Obtain the number of elements of R objects [arrays, matrices, and vectors (including lists)] in a manner compatible with GNU Octave/MATLAB. Some documentation from length.

Usage

numel(x, ...)

Arguments

x

An R object (array, matrix, vector)

...

R objects (indices idx1, idx2, ...)

Value

"Return the number of elements in the R object x. Optionally, if indices idx1, idx2, ... are supplied, return the number of elements that would result from the indexing a(idx1, idx2, ...)." Source: Eaton page 41.

Author(s)

Irucka Embry, Samit Basu (FreeMat)

Source

  1. r - Add a Column to a Dataframe From a List of Values - Stack Overflow answered by Matthew Plourde on Jun 21 2012. See https://stackoverflow.com/questions/11130037/add-a-column-to-a-dataframe-from-a-list-of-values/11130178.

  2. r - Why does is.vector() return TRUE for list? - Stack Overflow answered by Andrie on May 17 2011. See https://stackoverflow.com/questions/6032772/why-does-is-vector-return-true-for-list/6032909.

References

  1. Samit Basu (2002-2006). FreeMat v4.0, https://freemat.sourceforge.net/help/inspection_numel.html.

  2. John W. Eaton, David Bateman, Søren Hauberg, and Rik Wehbring (November 2022). GNU Octave: A high-level interactive language for numerical computations: Edition 7 for Octave version 7.3.0. https://docs.octave.org/octave.pdf. Pages 46-47.

See Also

numel, numel, size, length, length_octave

Examples


library(iemisc)

import::from(matlab, ones)

xx <- list(1:26, 1:10)

numel(xx)






iemisc documentation built on Sept. 25, 2023, 5:09 p.m.