Re: [R] Inflated Array

From: Ben Bolker <>
Date: Wed 19 Jul 2006 - 02:07:39 EST

Hadassa Brunschwig <dassybr <at>> writes:

> Hi R-users!
> I am trying to create a what I call inflated array (maybe there is
> already some other name for that). It is an array that changes
> dinamically its dimensions, e.g. the higher the number of third
> dimensions, the more rows in the array.

  base R doesn't have a data structure for this: arrays in R must not be "ragged" (i.e., every sub-array must have the same dimensions).

  So you would need to use a list of matrices in your example. I don't quite know the logic that you're using to decide what goes in each sub-table.

The basic example you give could be built by hand as follows:



  if you had used scan() or something else to get a long, flat vector (x) and also had a vector (v) that indicated the number of rows in each sub-table:

x <- 1:24
nrow <- c(1,2,3)
ncol <- 4

ind <- rep(1:length(nrow),ncol*nrow)


  seems to work.

   Ben Bolker mailing list PLEASE do read the posting guide! and provide commented, minimal, self-contained, reproducible code. Received on Wed Jul 19 02:20:03 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 19 Jul 2006 - 04:16:59 EST.

Mailing list information is available at Please read the posting guide before posting to the list.