[Rd] PR#8282

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Fri Nov 18 08:56:23 CET 2005


The attempt made was to reproduce exactly the example you reported (of 
course).

Notice that this is incorrect usage, as you are trying to replace one 
element by 2.  We have since found another example of this, and fixed it, 
but it is nothing new in 2.2.0.  Please try a current version of R 
(R-patched or R-devel).  The relevant NEWS item is

     o	Subassignment of a vector which increased the length of the
 	vector _and_ had the wrong length of replacement could
 	occasionally segfault.  (This has been there since at least
 	mid 1997.)

It is poor practice to increase the size of a vector in this way rather
than pre-allocate.  Perhaps it has persisted so long because it is a user 
error in poor practice that can need 1000000 repeats to reproduce.


On Fri, 18 Nov 2005 pdbailey at uchicago.edu wrote:

> When an attempt was made to reproduce this on other platforms,
> how high was the index? For one of my Apples, I need to take
> it very high, maybe 1000000? Sorry, I guess I edited that part
> out.
>
> --
> zi <- vector()
> for(i in 1:1000000) {
>  zi[i] <- c(1,2)
> }
> zi[,1]
> --
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list