Information lost when adding a list to a list

I am trying to use the following code with R 2.13:

aa <- list()
aa["test"] <- list(x1=5,x2=7)

I get:

> aa
$test
[1] 5

but I would like closer:

$test
 $x1 5
 $x2 7

Can someone explain to me what I'm doing wrong? Thank!

+3
source share
1 answer

OK, just found what I'm doing wrong!

aa[["test"]] <- list(x1=5,x2=7)

There is a trick!

+4
source

All Articles