[Rd] Bug ? mine or ? in R core

Michael Lapsley mlapsley@ndirect.co.uk
Sun, 2 Apr 2000 00:28:21 +0100


Thanks, Peter, it seems to do the trick.  I spent a lot of
time trying first to reproduce then identify this one!

What is the 'approved' method of resizing a vector?
Is SET_LENGTH deprecated, or does it just happen that there is
no need for it in tht R internals?


Michael

On Sat, Apr 01, 2000 at 08:31:42PM +0200, Peter Dalgaard BSA wrote:
> > /* transpose it */
> > DBG(1,"trimming");
> > SET_LENGTH(data,j*NCOLS); /* trim down buffer*/
>   ^^^^^^^^^^^^^^^^^^^^^^^^
> 
> I'm not too well accustomed to these macros (they aren't used in the R
> internals), but in Rdefines.h we have
> 
> #define SET_LENGTH(x, n)       (x = lengthgets(x, n))
> 
> so I wouldn't count on "data" being the same after those operations,
> and in particular not expect it to be protected anymore. You probably
> need to stick in "UNPROTECT(1); PROTECT(data);" after the SET_LENGTH
> operations.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._