How do I see source code with comments?

白昼怎懂夜的黑 提交于 2019-12-23 10:06: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.


回答1:


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



来源:https://stackoverflow.com/questions/18005488/how-do-i-see-source-code-with-comments

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!