From mao@compstat.wharton.upenn.edu  Sun May  9 18:01:28 1999
From: mao@compstat.wharton.upenn.edu (mao@compstat.wharton.upenn.edu)
Date: Sun, 9 May 1999 19:01:28 +0200 (MET DST)
Subject: subscripting in list() (PR#187)
Message-ID: <199905091701.TAA05120@pubhealth.ku.dk>


Sorry My previous report is not detailed.

In R, you will get this:

> mylist <- list()
> mylist[[1]]
Error in mylist[[1]] : subscript out of bounds
> mylist[[1]] <- c(1)
Error: (list) object cannot be coerced to vector type 14
> mylist[[1]] <- c(1,2)
> mylist[[1]] <- c(1)
> mylist
[[1]]
[1] 1

I was trying to assigning c(1) to (mylist[[1]] <- c(1)) -- it seems
impossible if I dont' assign something else to it in advance.

(although a walk around would be mylist[1] <- list(1)) In
SPLUS 4 or 3.4, the reactions are different:

> mylist <- list()
> mylist[[1]]
NULL
> mylist[[1]] <- c(1)
> mylist
[[1]]:
[1] 1





On Sun, 9 May 1999, Wenxin Mao wrote:

> Date: Sun, 9 May 1999 12:42:29 -0400 (EDT)
> From: Wenxin Mao <mao@stat.wharton.upenn.edu>
> To: r-bugs@biostat.ku.dk
> Subject: subscripting in list()
> 
> 
> In R, (0.64 Binary, Linux 5.0) I tried this command and get an error
> message:
> 
> > mylist <- list()
> > mylist[[1]]
> Error in mylist[[1]] : subscript out of bounds
> 
> It thus makes my Splus programs un-runable, because in SPlus 4.0 or 3.4,
> you have
> 
> > mylist <- list()
> > mylist[[1]]
> NULL
> 
> instead of a stop message.
> 
> 
> Thanks,
> vincent
> 
> 
> 
> 
> 
> 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


subscripting in list() (PR#187)
mao@compstat.wharton.upenn.edu