Hi

I'm having slight confusion.

I plan to grow/realloc a matrix depending on the data available in a C
program.

Here is what I'm tried to do:

Data=allocMatrix(REALSXP,3,4);

SEXP Data;

REAL(Data)[8]=0.001123;
REAL(Data)[200000]=0.001125;
printf("%f %f\n\n\n\n",REAL(Data)[8],REAL(Data)[200000]);

Here is my confusion:

Do I always require to allocate the exact number of data elements in a R
Matrix? In the above code segment I have clearly exceeded the number of
elements that have been allocated but my program doesn't crash.

I don't find any specific R functions for reallocation incase my data set
grows. How do I reallocate? Is it necessary to reallocate or is R handling
the memory management for the matrix that I have allocated?

Regards

Abhijit Bera

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to