e: [R] Create R object
Here is the answer for the second part:
> lst=list(a1=matrix(rnorm(4),2,2),
a2=matrix(rnorm(4),2,2),a3=matrix(rnorm(4),2,2))
> l.dim <- sapply(lst, dim)
> l.dim
a1 a2 a3
[1,] 2 2 2
Here is the answer for the second part:
> lst=list(a1=matrix(rnorm(4),2,2),
a2=matrix(rnorm(4),2,2),a3=matrix(rnorm(4),2,2))
> l.dim <- sapply(lst, dim)
> l.dim
a1 a2 a3
[1,] 2 2 2
[2,] 2 2 2
> all(l.dim[1,1] == l.dim[1,]) && all(l.dim[2,1] == l.dim[2,])
[1] TRUE
>
For the first part, w
Dear R users,
I have two simple questions here, and hope someone can help me on this. Thanks
in advance.
1.
I have a list object lst=list(a1=matrix(rnorm(4),2,2),
a2=matrix(rnorm(4),2,2),a3=matrix(rnorm(4),2,2)). Here I only use three
elements for illustration, and in fact the length of lst, n
3 matches
Mail list logo