# size: Size of R objects (GNU Octave/MATLAB compatible) In iemisc: Irucka Embry's Miscellaneous Functions

## Description

Provides the dimensions of R objects in a manner compatible with GNU Octave/MATLAB. This function is the same as `size`, except this `size` can find the size of character vectors too. Some documentation from `size`.

## Usage

 `1` ```size(x, k) ```

## Arguments

 `x` An R object (array, vector, or matrix) `k` integer specifying a particular dimension

## Value

"Return the number of rows and columns of the object x as a numeric vector. If given a second argument, `size` will return the size of the corresponding dimension." Source: Eaton.

## Author(s)

Hans Werner Borchers (pracma size), Irucka Embry

## Source

pracma size function definition - R package pracma created and maintained by Hans Werner Borchers. See `size`.

## References

John W. Eaton, David Bateman, and Søren Hauberg (2009). GNU Octave version 3.0.1 manual: a high-level interactive language for numerical computations. CreateSpace Independent Publishing Platform. ISBN 1441413006, URL http://www.gnu.org/software/octave/doc/interpreter/. Page 42.

`dim`, `size`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55``` ```library("iemisc") library(gsubfn) # Examples from GNU Octave size object1 <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 3, ncol = 2, byrow = TRUE) size(object1) list[nr, nc] <- size(matrix(c(1, 2, 3, 4, 5, 6), nrow = 3, ncol = 2, byrow = TRUE)) size(matrix(c(1, 2, 3, 4, 5, 6), nrow = 3, ncol = 2, byrow = TRUE), 2) # Examples from pracma size size(1:8) size(matrix(1:8, 2, 4)) size(matrix(1:8, 2, 4), 2) size(matrix(1:8, 2, 4), 3) ss <- "object" size(ss) ## Not run: # check against GNU Octave library(RcppOctave) # requires Octave (>= 3.2.4) and its development files o_source(text = " \ object1 = [1, 2; 3, 4; 5, 6]; size(object1) [nr, nc] = size([1, 2; 3, 4; 5, 6]) size([1, 2; 3, 4; 5, 6], 2) \ size(1:8) object2 = [1 3 5 7; 2 4 6 8]; size(object2) size(object2, 2) size(object2, 3) ss = 'object'; size(ss) ") ## End(Not run) ```