c++ - 如何获取R的辅助函数的C/C++源代码?

标签 c++ c r function

我想知道获取 R 中任何辅助函数(以区别于原始/内部函数)的 C/C++ 源代码的正确方法是什么。 相关问题有here , here , herehere :

我的不同,因此我在问题中使用了“次要”。 例如,我在 R 控制台中得到的 read.table() 函数:

>?read.table

read.table                package:utils                R Documentation

Data Input

Description:

     Reads a file in table format and creates a data frame from it,
     with cases corresponding to lines and variables to fields in the
     file.

Usage:
     read.table(file, header = FALSE, sep = "", quote = "\"'",
        ......

或者

> getAnywhere(read.table)
A single object matching ‘read.table’ was found
It was found in the following places
  package:utils
  namespace:utils
with value

function (file, header = FALSE, sep = "", quote = "\"'", dec = ".", 

     ......

    attr(data, "row.names") <- row.names
    data
}
<bytecode: 0x560ff88edd40>
<environment: namespace:utils>

搜索我得到的网站:

https://svn.r-project.org/R/trunk/src/library/utils/src/utils.c

https://svn.r-project.org/R/trunk/src/library/utils/src/utils.h

如何获取read.table函数的C/C++源代码而不是R代码,如果这合理的话?

最佳答案

可搜索的 R 源代码位于 https://github.com/wch/r-source对此确实很有用:

所以你在这里:read.table 的底层 C 实现可以在 src/main/scan.c 中找到,从函数 do_scan 开始.

关于c++ - 如何获取R的辅助函数的C/C++源代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52545380/

相关文章:

c++ - 当调用具有等待条件变量的线程对象的析构函数时会发生什么?

c - For循环两个数字之间的数字和

c - C 程序 malloc 赋值返回 NULL 的可能原因?

c - 短数组的最佳排序函数

c++ - 在 R 中快速重复构建包

c++ - 编写带有可选参数的函数

c++ - 如何捕获在 C++ 中运行的命令的 exit_code 和 stderr?

R - 如何做 Python 的 Try Except

r - 基于 2 个其他列查找一列的平均值 RStudio

c++ - 当 C 代码调用 Fortran 子程序时,子程序顶部发生段错误