subscripting in list() (PR#187)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Sun, 9 May 1999 21:19:55 +0200 (MET DST)


On Sun, 9 May 1999 mao@compstat.wharton.upenn.edu wrote:

> 
> 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

Yes, that is a known difference, I believe deliberate.

> > mylist[[1]] <- c(1)
> Error: (list) object cannot be coerced to vector type 14

I get no error in 0.64.1, the current version (since Friday): try
upgrading.

> > In R, (0.64 Binary, Linux 5.0) I tried this command and get an error
> > message:

(I assume you tried 0.64.0: there is no 0.64 that I know of.)

I do suggest though that you only index lists by names: relying on the
order of list components is fraught with possibilities for error.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._