Hi, Oleg,
Thanks very much for your answer! I was indeed confused; thinking
that Realloc was intended to be an analog to realloc (except for SEXP
variables).
Is there a way to do either of the following:
-- resize the SEXP directly (for my purpose, I ONLY need to decrease
the size), or
-- assign
Charles Danko wrote:
> Hi, Oleg,
>
> Thanks very much for your answer! I was indeed confused; thinking
> that Realloc was intended to be an analog to realloc (except for SEXP
> variables).
>
> Is there a way to do either of the following:
> -- resize the SEXP directly (for my purpose, I ONLY n
Rblah in your example is a SEXP structure. Realloc is an interface to C
realloc and is not intended to resize SEXP structures -- it is used to
resize user-controlled memory (which is generally not created by
allocVector/INTEGER).
You would expect a call like:
int * val;
...
Realloc(val, 20, in
Hi,
Trying to decrease the size of a SEXP variable without reassigning
values individually in a loop.
So far, I've tried using Realloc, as the follow source demonstrates:
SEXP dothis() {
SEXP Rblah;
PROTECT(Rblah = NEW_INTEGER(6));
int* blah = INTEGER(Rblah);
blah