I am trying to try some C code from base R. I may need to modify the code and compile it to understand how it works.
For example, I am trying to understand the function C_modelmatrix
.
One thing can be done is that I directly modify the source code
src/library/stats/src/model.c
where modelmatrix()
is defined. But I
will need to compile the whole R source and load this newly modified
R, each time when I modify C_modelmatrix
. This process is not
efficient.
Another way is to only extract the related C code and compile it as an
.so
file. Then load the .so
file with an existing R. But this approach
seems to be difficult. I'm yet to figure out an exact procedure on how
to do this.
Does anybody have any suggestions on what might be the best way to play with the C code in base R?