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.
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