Re: [Rd] PR#8282

From: <ripley_at_stats.ox.ac.uk>
Date: Fri 18 Nov 2005 - 07:56:23 GMT


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@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@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

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

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri Nov 18 19:16:45 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Nov 2005 - 11:21:24 GMT