user2005253
user2005253

Reputation:

How do I see source code with comments?

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.

Upvotes: 5

Views: 472

Answers (1)

IRTFM
IRTFM

Reputation: 263362

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

Upvotes: 7

Related Questions