我正在研究包rimage
的一些功能.例如,如果您想查看 sobel.h
的代码函数,你得到:
> 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)
}
所以
sobel.h
函数使用名为 sobel_h
的 C 例程, ((我认为)存储在文件 rimage.dll
中)。有什么办法可以看到
sobel_h
的C代码吗?功能?(我说的是包
rimage
作为一个实际例子;但答案当然会推广到所有使用 .C 例程的包)。
最佳答案
检查这个:
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.
关于r - 如何显示 R 函数使用的 .C 例程的代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4174288/