如何查看带有注释的源代码? [英] How do I see source code with comments?

查看:281
本文介绍了如何查看带有注释的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想查看包含任何注释的R源代码,以查看包的作者如何运行他的代码,但是我不确定要使用什么命令来查看它。特别是,我试图在R tgp 包中查看 bgp()函数的源代码。到目前为止,我已经尝试过

I want to view the R source code with any comments included, to see how the author of the package is running his code, but I am unsure what command to use to see it. In particular, I am trying to see the source code for the bgp() function in the R tgp package. So far I have tried

library(tgp)
tgp::bgp
tgp:::bgp

但是这些命令中的每个命令仅显示去除了注释的源代码。

but each of these commands shows only the source code with the comments stripped away.

推荐答案

这为您提供了经过解析的代码版本,但是却删除了所有注释。软件包的来源在这里: http:// cran。 r-project.org/src/contrib/tgp_2.4-9.tar.gz

That is offering you the parsed version of the code, but it strips out all the comments. The package sources are here: http://cran.r-project.org/src/contrib/tgp_2.4-9.tar.gz

bgp代码位于R目录中的btgp.R中

The bgp code is in btgp.R in the R directory.

在CRAN上查找软件包原始资源的一般方法是:> https://cran.r-project.org/web/packages/available_packages_by_name.html

The general approach to finding the original source to a package on CRAN is to go to: https://cran.r-project.org/web/packages/available_packages_by_name.html

这篇关于如何查看带有注释的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆