install.packages 省略源文件

install.packages omits source files

R 使安装包变得容易,例如,

install.packages("rmarkdown")

效果很好,评论结束

The downloaded source packages are in
    ‘/tmp/Rtmpb9da02/downloaded_packages’`

但在这之后,目录/usr/local/lib/R/site-library/rmarkdown/R只包含3个文件:rmarkdownrmarkdown.rdbrmarkdown.rdx

相比之下,刚刚下载的 /tmp/Rtmpb9da02/downloaded_packages/rmarkdown_1.11.tar.gz 将提供相应目录 rmarkdown/R 和完整的源文件:

base64.R                html_vignette.R            render_html.R
beamer_presentation.R   includes.R                 render.R
draft.R                 ioslides_presentation.R    render_site.R
github_document.R       knit_print.R               rtf_document.R
html_dependencies.R     latex_dependencies.R       shiny_module.R
html_document_base.R    list_builder.R             shiny_prerendered.R
html_document.R         md_document.R              shiny.R
html_extras.R           odt_document.R             slidy_presentation.R
html_fragment.R         output_format.R            stack.R
html_notebook_output.R  pandoc.R                   tufte_handout.R
html_notebook.R         params.R                   util.R
html_paged.R            pdf_document.R             word_document.R
html_parser.R           performance.R              zzz.R
html_resource_copy.R    powerpoint_presentation.R
html_resources.R        relative_to.R

为什么要隐瞒来源?

我应该如何获得它们?除了 tar zxf 之外,还有 "best practice" 方法吗?我正在寻找一个允许我修改一个或多个源文件、重新构建包并将其重新加载到我的 R 进程中的安装。一个额外的好处是连接源代码背后的源代码控制系统,例如 git.

您可以像以前一样下载源代码,根据需要修改 R 文件并重新安装:

install.packages('/path/to/my_rmarkdown_1.11', repos= NULL, type= 'source')