And how would you do this at R level?
I would use length(A) <- M, and the corresponding C function is
lengthgets.
Of course, the wasteful part is to create a far-too-long vector in the
first place, rather than growing it as needed.
On Wed, 10 Mar 2010, Saptarshi Guha wrote:
Hello,
I creat
Hello,
I create a VECSXP(call it A) with size N(~ 5000), i then proceed to
fill the elements and find out I don't need to fill more than
M (M<< N).
Thus if i return A to the user's R code, he/she will see a list of
length 5K of which N-M are NULLs.
To avoid this, I create a new VECSXP B of length