How to find out which .c file contains the .c functions of R internals, on Windows?

后端 未结 4 409
南方客
南方客 2020-12-10 03:06

I want to view the source code of R\'s match.call function. As it is an internal function, I downloaded the R source code, went to ./src/main/names.c and looked

4条回答
  •  眼角桃花
    2020-12-10 03:53

    I know this has been asked a long time ago, but since it's still relevant, I thought I'd add some resources people can use to find the proper R source files.

    1. First, with pryr you can use the show_c_source function which will search on GitHub the relevant piece of code in the C source files.

      body(match.call)
      
      # .Internal(match.call(definition, call, expand.dots))
      
      pryr::show_c_source(.Internal(match.call(definition, call, expand.dots)))
      

      Which takes you to this page, showing that unique.c contains the function do_matchcall.

    2. I've put together this tab delimited file, building on the names.c file and using find-in-files to determine the location of the source code. There are some functions that have platform-specific files, and a handful of others for which there is more than one file with relevant source code. But for the rest the mapping is pretty well established, at least for the current version (3.1.2).

提交回复
热议问题