Locating/downloading header 文件 R.h 和 C 与 R 接口的 Rmath
Locating/downloading header files R.h and Rmath for C interfacing with R
关于这个问题有很多类似的问题,但是 none 似乎告诉我在哪里可以得到 R.h 和 Rmath.h header 文件,如果我还没有它们(我已经搜索了我的电脑,但它们不在那里)。这些是将 C/C++ 函数与 R 代码链接起来所必需的 header。
简单来说,header应该放在哪个R包里,或者有什么网站可以下载?
This question mentions the R-devel package, but that does not seem to be available to me in my version of R (3.1.1). Other questions on Stack Overflow found here, here, and here,但没有直接回答我不认为的问题。
感谢任何帮助。
克里斯托弗
大多数 Linux 发行版应该有 locate
:
edd@max:~$ locate Rmath.h | grep "usr/" | grep -v "local/"
/usr/include/Rmath.h
/usr/include/JAGS/JRmath.h
/usr/share/R/include/Rmath.h
edd@max:~$
(我这里有开发版本、版本控制检查和 Debian 软件包的源代码,因此 grep
。还显示了一个来自 JAGS 的误报。)
最后,"official" 解决这个问题的方法是询问 R 本身:
edd@max:~$ R CMD config --cppflags
-I/usr/share/R/include
edd@max:~$
您可以从这个 link -
中获取代码
Rmath.h
https://www.cs.kent.ac.uk/projects/cxxr/doc/html/Rmath_8h_source.html
R.h-
https://www.cs.kent.ac.uk/projects/cxxr/doc/html/R_8h_source.html
它们应该在 R 的 RHOME
文件夹下面的 include
文件夹中。
$ R RHOME
/home/rowlings/Downloads/R-3.2.1
$ ls -l `R RHOME`/include
total 108
-rw-r--r-- 1 rowlings rowlings 511 Jun 29 17:34 Rconfig.h
-rw-r--r-- 1 rowlings rowlings 5916 Jun 29 17:34 Rdefines.h
-rw-r--r-- 1 rowlings rowlings 2085 Jun 29 17:34 Rembedded.h
drwxr-xr-x 2 rowlings rowlings 4096 Jun 29 17:34 R_ext
-rw-r--r-- 1 rowlings rowlings 2063 Jun 29 17:34 R.h
-rw-r--r-- 1 rowlings rowlings 4818 Jun 29 17:34 Rinterface.h
-rw-r--r-- 1 rowlings rowlings 46137 Jun 29 17:34 Rinternals.h
-rw-r--r-- 1 rowlings rowlings 17619 Jun 29 17:34 Rmath.h
-rw-r--r-- 1 rowlings rowlings 509 Jun 29 17:34 Rversion.h
-rw-r--r-- 1 rowlings rowlings 2142 Jun 29 17:34 S.h
这些 headers 包含在 R 安装中(无论是来自 CRAN 还是从源代码构建);你应该能够在 R session 中使用 R.home()
找到它们;例如
list.files(R.home("include"))
给我
> list.files(R.home("include"))
[1] "libintl.h" "R_ext" "R.h"
[4] "Rconfig.h" "Rdefines.h" "Rembedded.h"
[7] "Rinterface.h" "Rinternals.h" "Rmath.h"
[10] "Rversion.h" "S.h"
关于这个问题有很多类似的问题,但是 none 似乎告诉我在哪里可以得到 R.h 和 Rmath.h header 文件,如果我还没有它们(我已经搜索了我的电脑,但它们不在那里)。这些是将 C/C++ 函数与 R 代码链接起来所必需的 header。
简单来说,header应该放在哪个R包里,或者有什么网站可以下载?
This question mentions the R-devel package, but that does not seem to be available to me in my version of R (3.1.1). Other questions on Stack Overflow found here, here, and here,但没有直接回答我不认为的问题。
感谢任何帮助。
克里斯托弗
大多数 Linux 发行版应该有 locate
:
edd@max:~$ locate Rmath.h | grep "usr/" | grep -v "local/"
/usr/include/Rmath.h
/usr/include/JAGS/JRmath.h
/usr/share/R/include/Rmath.h
edd@max:~$
(我这里有开发版本、版本控制检查和 Debian 软件包的源代码,因此 grep
。还显示了一个来自 JAGS 的误报。)
最后,"official" 解决这个问题的方法是询问 R 本身:
edd@max:~$ R CMD config --cppflags
-I/usr/share/R/include
edd@max:~$
您可以从这个 link -
中获取代码Rmath.h https://www.cs.kent.ac.uk/projects/cxxr/doc/html/Rmath_8h_source.html
R.h- https://www.cs.kent.ac.uk/projects/cxxr/doc/html/R_8h_source.html
它们应该在 R 的 RHOME
文件夹下面的 include
文件夹中。
$ R RHOME
/home/rowlings/Downloads/R-3.2.1
$ ls -l `R RHOME`/include
total 108
-rw-r--r-- 1 rowlings rowlings 511 Jun 29 17:34 Rconfig.h
-rw-r--r-- 1 rowlings rowlings 5916 Jun 29 17:34 Rdefines.h
-rw-r--r-- 1 rowlings rowlings 2085 Jun 29 17:34 Rembedded.h
drwxr-xr-x 2 rowlings rowlings 4096 Jun 29 17:34 R_ext
-rw-r--r-- 1 rowlings rowlings 2063 Jun 29 17:34 R.h
-rw-r--r-- 1 rowlings rowlings 4818 Jun 29 17:34 Rinterface.h
-rw-r--r-- 1 rowlings rowlings 46137 Jun 29 17:34 Rinternals.h
-rw-r--r-- 1 rowlings rowlings 17619 Jun 29 17:34 Rmath.h
-rw-r--r-- 1 rowlings rowlings 509 Jun 29 17:34 Rversion.h
-rw-r--r-- 1 rowlings rowlings 2142 Jun 29 17:34 S.h
这些 headers 包含在 R 安装中(无论是来自 CRAN 还是从源代码构建);你应该能够在 R session 中使用 R.home()
找到它们;例如
list.files(R.home("include"))
给我
> list.files(R.home("include"))
[1] "libintl.h" "R_ext" "R.h"
[4] "Rconfig.h" "Rdefines.h" "Rembedded.h"
[7] "Rinterface.h" "Rinternals.h" "Rmath.h"
[10] "Rversion.h" "S.h"