How do I see source code with comments?

2019-07-03 21:57发布

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.

标签: r comments
1条回答
Root(大扎)
2楼-- · 2019-07-03 22:38

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

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

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

查看更多
登录 后发表回答