I was studying some functions of the package rimage
. If you want to see, for example, the code for the sobel.h
function, you obtain:
> library(rimage)
> sobel.h
function (img)
{
w <- dim(img)[2]
h <- dim(img)[1]
imagematrix(abs(matrix(.C("sobel_h", as.double(img), as.integer(w),
as.integer(h), eimg = double(w * h), PACKAGE = "rimage")$eimg,
nrow = h, ncol = w)), noclipping = TRUE)
}
So the sobel.h
function uses the C routine called sobel_h
, (which is (I think) stored in the file rimage.dll
).
Is there any way to see the C code of the sobel_h
function?
(I speak about the package rimage
for a practical example; but the answer would of course generalised to all packages that uses .C routines).
Check this: Uwe Ligges. R Help Desk: Accessing the sources. R News, 6(4):43-45, October 2006.
In order to access the sources of compiled code (i.e., C, C++, or Fortran), it is not sufficient to have the binary version of R or a contributed package installed. Rather, it is necessary to download the sources for R or for the package.
The Linux source for rimage is here: http://cran.r-project.org/src/contrib/rimage_0.5-8.1.tar.gz Windows source is here: http://cran.r-project.org/bin/windows/contrib/r-release/rimage_0.5-8.1.zip
sobel.c is in the rimage/src/ directory in the unpacked files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With