R CRAN中的注释检查:没有存储库集,因此跳过循环依赖性检查

Tyl*_*ker 37 r package cran

从R 3.1.0开始,我得到以下R检查:

* checking package dependencies ... NOTE
  No repository set, so cyclic dependency check skipped
Run Code Online (Sandbox Code Playgroud)

我试过这个建议:https://twitter.com/phylorich/status/431911660698083328

不行.我将该行options(repos="http://cran.rstudio.com/")放在包根目录中的.Rprofile中.仍然得到注意.

另外,编写R扩展的第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.
Run Code Online (Sandbox Code Playgroud)

这可能是由于set environment variable R_WIN_NO_JUNCTIONS?如果是这样我怎么能这样做呢?注释的任何其他可能原因或建议的修复?

Pet*_*usu 21

从写R扩展

DESCRIPTION文件中循环声明的测试需要存储库(包括CRAN)集:在〜/ .Rprofile中执行此操作,例如

options(repos = c(CRAN="http://cran.r-project.org"))
Run Code Online (Sandbox Code Playgroud)

推荐的

用户应仔细检查他的.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"))
Run Code Online (Sandbox Code Playgroud)

或使用额外包来自R会话:

library(pathological)
r_profile()
Run Code Online (Sandbox Code Playgroud)

用户应仔细检查选项条目是否未嵌套在IF条件中,如下面的代码所示:

# this will not help for R CMD check --as-cran
if(interactive()) {
options(repos = c(CRAN="http://cran.r-project.org"))
}
Run Code Online (Sandbox Code Playgroud)

适用于任何平台的干运行

这是R脚本准备R包的简单临时案例进行测试,有助于更快地找到您当地使用中出现的问题.这个方法帮助我找到了我的.Rprofile文件中的错误,并且通常可以帮助设置工作初始状态.在最好的情况下,检查运行应该只显示1个关于新提交的注释.

  1. 首先复制/粘贴代码并在R会话中获取代码(最好是--vanilla)
  2. 然后运行脚本打印的命令来检查测试用例--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
Run Code Online (Sandbox Code Playgroud)

如果.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,name,'man',paste0(name,'-package.Rd'))
    )

# adjust DESCRIPTION
D <- readLines(file.path(path,name,"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,file.path(path,name,"DESCRIPTION"))

# make fu.Rd
write(
"\\name{fu}\\alias{fu}\\title{Prints}\\description{Prints}
\\usage{fu()}\\examples{fu()}",
file.path(path,name,'man','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, name,  userRp, file.path(path,name) 
)

# now is time to check the skeleton
message(msg)
Run Code Online (Sandbox Code Playgroud)

检查包裹

# replace package-path by the path adviced by the sourcing the script above
R --no-site-file CMD check --as-cran package-path
Run Code Online (Sandbox Code Playgroud)

有用户配置文件和站点配置文件,在上面的方法中,您可以通过使用--no-site-file包骨架选项选项来绕过站点配置文件(第二步).

PDF错误

您可能会遇到PDF和乳胶相关的错误,这些错误很可能是由于缺少或未完成乳胶安装造成的.Ycan使用--no-manual选项跳过PDF测试.

R --no-site-file CMD check --no-manual --as-cran /tmp/pkgtest
Run Code Online (Sandbox Code Playgroud)


jir*_*ec2 6

上面的答案仅适用于Linux.在Windows上,我必须使用不同的方法.当我尝试在Windows 7上的R 3.2.0中构建和检查我的新软件包时,我得到了同样的错误:

checking package dependencies ... NOTE
No repository set, so cyclic dependency check skipped
Run Code Online (Sandbox Code Playgroud)

我尝试在我的新包的根目录中创建一个.Rprofile文件,但是没有用.相反,我不得不去:

C:\Program Files\R\R-3.2.0\etc
Run Code Online (Sandbox Code Playgroud)

并编辑文件:

Rprofile.site
Run Code Online (Sandbox Code Playgroud)

在Rprofile.site文件中,我添加了建议的行:

options(repos = c(CRAN="http://cran.r-project.org"))
Run Code Online (Sandbox Code Playgroud)

在我编辑Rprofile.site文件之后,注释"没有存储库集,因此跳过循环依赖性检查"最终消失了.