从GitHub中的Vignette安装GitHub的R软件包

时间:2019-11-03 13:51:45

标签: r r-package cran

我已经构建了一个R包,并且可以在CRAN上使用。我正在更新一个小插图,我想从vignette中的GitHub安装一个软件包。 R CMD Checks在我的机器上顺利运行,但是提交到CRAN后,我收到一条消息,指示我需要将软件包安装到临时库中。

我使用此代码尝试将软件包安装到临时目录。该代码可在我的本地计算机上运行,​​并且R CMD检查在本地(devtools::check()devtools::check(remote = TRUE))通过。但是在CRAN计算机(rhub::check_for_cran())上运行时,检查失败。

# adding temp_path to .libPaths
temp_path <- file.path(tempdir(), "gt_folder"); dir.create(temp_path)
lib_path <-.libPaths()
.libPaths(c(lib_path, temp_path))

remotes::install_github("rstudio/gt", lib = temp_path)

gt::gt(mtcars)

这是我从rhub::check_for_cran()看到的错误。似乎依赖关系未得到正确处理。

   ERROR: dependencies 'lazyeval', 'reshape2', 'scales', 'tibble' are not available for package 'ggplot2'
-  removing 'C:/Users/USERVzKWFkopnQ/AppData/Local/Temp/RtmpIjoZQH/working_dir/RtmpiwGvJu/gt_folder/ggplot2'
   ERROR: dependencies 'fansi', 'utf8', 'vctrs' are not available for package 'pillar'
-  removing 'C:/Users/USERVzKWFkopnQ/AppData/Local/Temp/RtmpIjoZQH/working_dir/RtmpiwGvJu/gt_folder/pillar'

   The downloaded source packages are in
    'C:\Users\USERVzKWFkopnQ\AppData\Local\Temp\RtmpIjoZQH\working_dir\RtmpiwGvJu\downloaded_packages'
   ERROR: dependencies 'checkmate', 'commonmark', 'dplyr', 'fs', 'ggplot2', 'sass', 'scales', 'tibble', 'tidyselect' are not available for package 'gt'
-  removing 'C:/Users/USERVzKWFkopnQ/AppData/Local/Temp/RtmpIjoZQH/working_dir/RtmpiwGvJu/gt_folder/gt'
   Quitting from lines 18-45 (install_from_github.Rmd) 
   Error: processing vignette 'install_from_github.Rmd' failed with diagnostics:
   there is no package called 'gt'
   --- failed re-building 'install_from_github.Rmd'

   SUMMARY: processing the following file failed:
     'install_from_github.Rmd'

   Error: Vignette re-building failed.
   Execution halted

这是一个只有一个功能的轻型包装,上面有一个说明问题的小插图https://github.com/ddsjoberg/pkginstallgh

这是我从CRAN收到的笔记

Dear maintainer,

Pls see
<https://cran.r-project.org/web/checks/check_results_gtsummary.html>.

The check problems on the Debian systems are caused by attempts to write
to the user library to which all packages get installed before checking
(and which now is remounted read-only for checking).

Having package code which is run as part of the checks and attempts to
write to the user library violates the CRAN Policy's

  Packages should not write in the user’s home filespace (including
  clipboards), nor anywhere else on the file system apart from the R
  session’s temporary directory (or during installation in the location
  pointed to by TMPDIR: and such usage should be cleaned up).

In your case, you need to teach remotes::install_github("rstudio/gt") to
install to a temporary library and use it from there.

0 个答案:

没有答案