"changing its size using SETLENGTH (Rf_lengthgets)" NO! NO! NO! SETLENGTH does not do the same thing as Rf_lengthgets. You should never use SETLENGTH, which is not part of the API, and really should not even exist. For that matter Rf_lengthgets is also not part of the API. I recommend getting the length right to start with. Radford Neal
Dynamic list creation (SEXP in C) returns error "unimplemented type (29) in 'duplicate'" Dynamic list creation (SEXP in C) returns error
3 messages · Radford Neal, George Vega Yon
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20131106/af2da4a4/attachment.pl>
On Wed, Nov 06, 2013 at 02:40:59PM -0300, George Vega Yon wrote:
Hi! You are right, what I actually use is SET_LENGTH... Is that ok? El 06/11/2013 14:00, "Radford Neal" <radford at cs.toronto.edu> escribi?:
Is SET_LENGTH a documented feature of the API? Not that I can see. However, it is indeed different from SETLENGTH. Perhaps your problem is in the following code you posted: REPROTECT(SET_LENGTH(id, length(lambda) + z), ipx0); REPROTECT(SET_LENGTH(lambda,length(lambda) + z), ipx1); It looks like the first line should have length(id), not length(lambda). Your usage of REPROTECT and duplicate seems odd. If you make the stuff you allocate part of your original list as soon as you allocate it, you only need to protect the original list. And it's not clear why you think you need to duplicate vectors. Radford Neal