how about ?
for(i in 1:3)
{
b[[i]][[3]] <- 3
}
or:
for(i in 1:3)
{
b[[i]][[3]] <- a[[i]]
}
On Tue, Jun 30, 2009 at 6:54 AM, Ivo Shterev wrote:
>
> Dear All,
>
> I am interested to know how assign a list to a list of lists. For example
> how to assign the list a = list(3,3,3) to the list
Dear All,
I am interested to know how assign a list to a list of lists. For example how
to assign the list a = list(3,3,3) to the list b:
> b
[[1]]
[[1]][[1]]
[1] 0
[[1]][[2]]
[1] 0
[[1]][[3]]
[1] 0
[[2]]
[[2]][[1]]
[1] 0
[[2]][[2]]
[1] 0
[[2]][[3]]
[1] 0
[[3]]
[[3]][[1]]
[1] 0
[[3]][[
Another options is:
head(lapply(a, tail, 2), 2)
On Wed, Jun 24, 2009 at 8:42 PM, Ivo Shterev wrote:
>
> Hello,
>
> I have a question about list indexing. Lets say we have a list of 3 lists,
> each containing 3 different type elements:
>
> > a=replicate(3, list(list(c(1,1,1), diag(3), c(2,2,2)))
Ivo Shterev wrote:
>
>
> I have a question about list indexing. Lets say we have a list of 3 lists,
> each containing 3 different type elements:
>
>
(Details of your nice example code removed)
a=replicate(3, list(list(c(1,1,1), diag(3), c(2,2,2
str(a) # I prefer this to print(a) beca
Hello,
I have a question about list indexing. Lets say we have a list of 3 lists, each
containing 3 different type elements:
> a=replicate(3, list(list(c(1,1,1), diag(3), c(2,2,2
> a
[[1]]
[[1]][[1]]
[1] 1 1 1
[[1]][[2]]
[,1] [,2] [,3]
[1,]100
[2,]010
[3,]0
5 matches
Mail list logo