[R] matrix of bins with different length

2007-07-10 Thread Balazs Torma
Dear users,

please help to define the following data structure:

I would like to have a matrix, where every element is a container of  
different size , containing real numbers. The containers (bins) are  
addressed by an index pair [i,j] (i is number of corresponding row of  
the matrix, j is the coloumn of the matrix). The containers are  
initially empty, I would like to fill them dynamically (put certain  
numbers into different bins in each iteration).

I can not define a 3 dimensional array, because I don't know the  
length of the third dimension in advance, and because the vectors  
(containers) in the matrix are usually of different length.

Any help greatly appreciated,
Balazs Torma

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] matrix of bins with different length

2007-07-10 Thread Gabor Grothendieck
Try this:

 m - matrix(list(1, 1:2, 1:3, 1:4), 2)
 m[[1,1]]
[1] 1
 m[[2,1]]
[1] 1 2
 m
 [,1]  [,2]
[1,] 1 Integer,3
[2,] Integer,2 Integer,4


On 7/10/07, Balazs Torma [EMAIL PROTECTED] wrote:
 Dear users,

please help to define the following data structure:

 I would like to have a matrix, where every element is a container of
 different size , containing real numbers. The containers (bins) are
 addressed by an index pair [i,j] (i is number of corresponding row of
 the matrix, j is the coloumn of the matrix). The containers are
 initially empty, I would like to fill them dynamically (put certain
 numbers into different bins in each iteration).

 I can not define a 3 dimensional array, because I don't know the
 length of the third dimension in advance, and because the vectors
 (containers) in the matrix are usually of different length.

 Any help greatly appreciated,
 Balazs Torma

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.