Установите пакет R от GitHub в виньетке пакета - PullRequest
2 голосов
/ 03 ноября 2019

Я создал пакет R, и он доступен на CRAN. Я обновляю одну из виньеток и хочу установить пакет из GitHub в виньетку. Проверки CMD R проходили без проблем на моем компьютере, но после отправки в CRAN я получил сообщение о том, что мне нужно установить пакет во временную библиотеку.

Я использовал этот код, чтобы попытаться установить пакет во временный каталог. Код работает на моем локальном компьютере, и проверки CMD R проходят локально (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.
...