In fact there should be just one level of nesting but the top level
object must be a matrix, not a list, since the matrices that should be
embedded in it must be grouped after their nrow _and_ ncol - thus the
container object must be two-dimensional, a matrix. The only question is
how to get ri
Hm
I still suppose that you do not need matrix as a top level object. If you
are sure there is only one level of nesting, e.g. in each node of the list
there is only one level of saved matrices, you can get summary
information from str, length and/or summary.
lll<-list(a=1, b=2, c=list(a=1,b
Thanks, I was already told this solution by somebody (he just forgot to
add the mailing list as CC). Well, the purpose of the whole thing is to
get something like this:
http://home.att.net/~numericana/data/polycount.htm where the numbers in
the table cells give the number of matrices saved in t
Hi
Michael Kogan napsal dne 19.08.2009 17:22:04:
> Thanks, that was the solution! But in fact I didn't want to have this
> "list of lists" layer at all. And now I'm having trouble writing
> matrices into the database. It's really really strange... If I write a
> matrix into the database man
Thanks, that was the solution! But in fact I didn't want to have this
"list of lists" layer at all. And now I'm having trouble writing
matrices into the database. It's really really strange... If I write a
matrix into the database manually everything works, but if I create a
function which add
Hi
r-help-boun...@r-project.org napsal dne 19.08.2009 13:04:39:
> Strange, it doesn't work for me:
>
> Error in database[4, 4][[1]][1, ] : incorrect number of dimensions
> Execution halted
>
> R version 2.9.0 (2009-04-17) on Arch Linux, no additional packages
> installed.
database[4,4][[1]][,
This works, but then I can only save a single matrix in each
database[x,y] while I need to save a list of matrices.
Gabor Grothendieck schrieb:
Try this:
database[[4,4]] <- tetrahedron
database[[4,4]][1,]
[1] 0 1 1 1
On Wed, Aug 19, 2009 at 6:02 AM, Michael Kogan wrote:
Unfortu
Try this:
> database[[4,4]] <- tetrahedron
> database[[4,4]][1,]
[1] 0 1 1 1
On Wed, Aug 19, 2009 at 6:02 AM, Michael Kogan wrote:
> Unfortunately the matrix(list(),x,y) way seems to have some limitations. I
> want to continue working with the matrices which are saved in the database
> matrix.
Strange, it doesn't work for me:
Error in database[4, 4][[1]][1, ] : incorrect number of dimensions
Execution halted
R version 2.9.0 (2009-04-17) on Arch Linux, no additional packages
installed.
David Winsemius schrieb:
On Aug 19, 2009, at 6:02 AM, Michael Kogan wrote:
Unfortunately the m
On Aug 19, 2009, at 6:02 AM, Michael Kogan wrote:
Unfortunately the matrix(list(),x,y) way seems to have some
limitations. I want to continue working with the matrices which are
saved in the database matrix. But for example the following doesn't
work:
tetrahedron=matrix(c(
0,1,1,1,
1,0,
Unfortunately the matrix(list(),x,y) way seems to have some
limitations. I want to continue working with the matrices which are
saved in the database matrix. But for example the following doesn't work:
tetrahedron=matrix(c(
0,1,1,1,
1,0,1,1,
1,1,0,1,
1,1,1,0
),nrow=4, byrow=TRUE) # an example
Is this what you want:
> x <- matrix(list(),3,3) # create a matrix of lists
> # create matrices for testing
> for(i in 1:3){
+ for (j in 1:3){
+ x[[i,j]] <- matrix(runif((i+1) * (j+1)), i+1)
+ }
+ }
>
>
> x
[,1] [,2] [,3]
[1,] Numeric,4 Numeric,6 Numeric,8
[2,] Nu
Thanks, that was exactly what I looked for!
jim holtman schrieb:
Is this what you want:
x <- matrix(list(),3,3) # create a matrix of lists
# create matrices for testing
for(i in 1:3){
+ for (j in 1:3){
+ x[[i,j]] <- matrix(runif((i+1) * (j+1)), i+1)
+ }
+ }
x
Try this:
> m12 <- matrix(10, 1, 2)
> m22 <- matrix(20, 2, 2)
> # create matrix of lists of matrices
> M <- matrix(list(list(1, 2), list(m12, m12), list(t(m12)), list(m22, m22,
> m22)), 2, 2)
> M
[,1] [,2]
[1,] List,2 List,1
[2,] List,2 List,3
> M[[1,2]]
[[1]]
[,1]
[1,] 10
[2,] 1
Hi,
I'm new to programming, new to R and even new to mailing lists so please
be patient with me. I need to manage many matrices generated by an R
program. These matrices have different dimensions and I'd like to group
them somehow. The best way would be to have a big matrix (let's call it
dat
15 matches
Mail list logo