Re: [R] matrix of bins with different length

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue, 10 Jul 2007 11:38:16 -0400

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 <torma_at_sztaki.hu> 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_at_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_at_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. Received on Tue 10 Jul 2007 - 16:10:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 10 Jul 2007 - 16:32:50 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.