如何查看R的源代码(预解析)

时间:2022-05-18 11:40:45

Embarrassingly basic question.

令人尴尬的基本问题。

When wanting to understand R's source code I will often just write its name in R and read through the code. The downside of this method is that I will get the code with its comment stripped away.

当想要理解R的源代码时,我经常只在R中写下它的名字并读取代码。这种方法的缺点是,我将获得剥离其注释的代码。

Assuming I use git, and not subversion, what simple solutions do I have to view the source code?

假设我使用git而不是subversion,我有什么简单的解决方案来查看源代码?

For example, can I download the R's source code through git? (as in with github)

例如,我可以通过git下载R的源代码吗? (与github一样)

Is there some website with all of the code easily searchable?

是否有一些网站的所有代码都可以轻松搜索?

Thanks.

1 个解决方案

#1


6  

To download the current R-development svn using git-svn (you might need to install git-svn in addition to git):

要使用git-svn下载当前的R-development svn(除了git之外,您可能还需要安装git-svn):

git svn clone https://svn.r-project.org/R/trunk/

To browse R-project source code online, just visit the same site:

要在线浏览R项目源代码,只需访问同一站点:

https://svn.r-project.org/R/trunk/

Or, for the other branches:

或者,对于其他分支:

https://svn.r-project.org/R/

To search for, say, glm() related code in the R-development source code, I usually try a Google search:

要搜索R-development源代码中的glm()相关代码,我通常会尝试Google搜索:

glm site:svn.r-project.org/R/trunk/

#1


6  

To download the current R-development svn using git-svn (you might need to install git-svn in addition to git):

要使用git-svn下载当前的R-development svn(除了git之外,您可能还需要安装git-svn):

git svn clone https://svn.r-project.org/R/trunk/

To browse R-project source code online, just visit the same site:

要在线浏览R项目源代码,只需访问同一站点:

https://svn.r-project.org/R/trunk/

Or, for the other branches:

或者,对于其他分支:

https://svn.r-project.org/R/

To search for, say, glm() related code in the R-development source code, I usually try a Google search:

要搜索R-development源代码中的glm()相关代码,我通常会尝试Google搜索:

glm site:svn.r-project.org/R/trunk/