Ok, I got it. I should have to define a as a list, in order to get a sane
behaviour... That makes sense:

> a <- as.list(NULL)
> a[["item"]] <- 1:3
> a$item
[1] 1 2 3

Best,

Philippe Grosjean

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Philippe Grosjean
Sent: jeudi 26 juin 2003 5:25
To: [EMAIL PROTECTED]
Subject: [R] assignment in lists


Hello,

I do not understand the following behaviour. Could someone explain me what
happens?

> a <- NULL
> a$item <- 1:3
> a$item
[1] 1 2 3
> rm(a)
> a <- NULL
> a[["item"]] <- 1:3
Error: more elements supplied than there are to replace

Why do I get an error message using list[["item"]], and not using list$item?
Best,

Philippe Grosjean

...........]<(({�<...............<�}))><...............................
 ) ) ) ) )
( ( ( ( (       Dr. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (       LOV, UMR 7093
 ) ) ) ) )      Station Zoologique
( ( ( ( (       Observatoire Oc�anologique
 ) ) ) ) )      BP 28
( ( ( ( (       06234 Villefranche sur mer cedex
 ) ) ) ) )      France
( ( ( ( (
 ) ) ) ) )      tel: +33.4.93.76.38.18, fax: +33.4.93.76.38.34
( ( ( ( (
 ) ) ) ) )      e-mail: [EMAIL PROTECTED]
( ( ( ( (       SciViews project coordinator (http://www.sciviews.org)
 ) ) ) ) )
.......................................................................

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to