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)
if (FALSE) {
# 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)
")
}
Run the code above in your browser using DataLab