* checking package dependencies ... NOTE No repository set,so cyclic dependency check skipped
我试过这个建议:https://twitter.com/phylorich/status/431911660698083328
没有去。我把行选项(repos =“http://cran.rstudio.com/”)放在包根目录中的.Rprofile中。仍然得到的注。
Writing R Extensions的1.3.1节还规定:
Some Windows users may need to set environment variable R_WIN_NO_JUNCTIONS to a non-empty value. The test of cyclic declarations33in DESCRIPTION files needs repositories (including CRAN) set: do this in ~/.Rprofile.
这可能是设置环境变量R_WIN_NO_JUNCTIONS的结果吗?如果是这样,我怎么可以这样做?注意或建议修复的任何其他可能的原因?
DESCRIPTION文件中循环声明的测试需要知识库(包括CRAN)设置:在〜/ .Rprofile中执行此操作,例如
options(repos = c(CRAN="http://cran.r-project.org"))
推荐的
用户应该仔细检查他的.Rprofile是否在他的家,并且它包含所提到的选项。
# in R session (any platform) # where is my profile? file.path(Sys.glob("~"),".Rprofile") # is it there? file.exists(file.path(Sys.glob("~"),".Rprofile"))
或者从R会话使用额外的包:
library(pathological) r_profile()
用户应该仔细检查选项条目是否没有嵌套在IF条件中,如下面的代码所示:
# this will not help for R CMD check --as-cran if(interactive()) { options(repos = c(CRAN="http://cran.r-project.org")) }
任何平台的干运行
这里是R脚本准备容易临时案例的R包测试,帮助更快地找到你的本地使用中出了什么问题。
这个aproach帮助我找到我的.Rprofile文件中出了什么错误,一般可以帮助设置工作初始状态。
在最好的情况下,检查运行应该只显示1关于新提交的注释。
>首先复制/粘贴代码并将其源代码到您的R会话(–vanilla
优选)
>然后运行由脚本打印的命令以检查测试用例–as-cran。
例
# for example R --vanilla -f makePackage.R # here the resulting package path is as below R --no-site-file CMD check --as-cran /tmp/pkgtest # now see the check log
如果您的.Rprofile不存在,它将被创建,并且在任何情况下,一个新行放置在文件末尾。
makePackage.R脚本
# makePackage.R # makes simple package for playing with check --as-cran # copy this content to file makePackage.R # then source it into your R --vanilla session name <- "pkgtest" # # prepare and adjust package template # tempbase <- dirname(tempdir()) e <- new.env() path <- dirname(tempdir()) # make simple package in path e$fu <- function(){"Hello"} package.skeleton(name=name,force=T,path=path,environment=e) nil <- file.remove( file.path(path,name,'Read-and-delete-me'),file.path(path,'man',paste0(name,'-package.Rd')) ) # adjust DESCRIPTION D <- readLines(file.path(path,"DESCRIPTION")) D[grepl("^Title: ",D)] <- "Title: Testing Skeleton" D[grepl("^Author: ",D)] <- "Author: John Doe" D[grepl("^Description: ",D)] <- "Description: Checking --as-cran check." D[grepl("^Maintainer: ",D)] <- "Maintainer: John Doe <jdoe@doe.net>" D[grepl("^License: ",D)] <- "License: GPL (>= 2)" write(D,"DESCRIPTION")) # make fu.Rd write( "\\name{fu}\\alias{fu}\\title{Prints}\\description{Prints} \\usage{fu()}\\examples{fu()}",'fu.Rd')) # # ensure that .Rprofile contains repos option # add fresh new line et the end of .Rprofile # userRp <- file.path(Sys.glob("~"),".Rprofile") write("options(repos = c(CRAN='http://cran.r-project.org'))",file=userRp,append=TRUE) # # print final message # msg <- sprintf(" Your test package was created in %s,under name %s,your user .Rprofile in %s was modified (option repos),now check this test package from command line by command: R --no-site-file CMD check --as-cran %s ",path,userRp,name) ) # now is time to check the skeleton message(msg)
检查包
# replace package-path by the path adviced by the sourcing the script above R --no-site-file CMD check --as-cran package-path
有用户配置文件和网站配置文件,在上面的方法绕过网站配置文件(在第二步)通过使用–no-site-file选项包框架选项。
PDF错误
你可以体验PDF和乳胶相关的错误,很可能是由于缺少或不完全胶乳安装。可以使用–no-manual选项跳过PDF测试。
R --no-site-file CMD check --no-manual --as-cran /tmp/pkgtest