问题描述
我曾经能够在github存储库中构建我的R包,但是devtools函数已被弃用,并被新的函数取代,这些新函数不再允许我这样做。
I used to be able to build my R packages within my github repo, but the devtools functions have been deprecated and replaced with new functions that won't allow me to do this anymore.
我以前在目录 / home / User /中使用
,以创建我的R包 devtools :: setup('NewPackage',check = FALSE)
NewPackage / / home / User / NewPackage / NewPackage
I was previously using devtools::setup('NewPackage', check=FALSE)
in my directory /home/User/NewPackage/
, to create my R package /home/User/NewPackage/NewPackage
新的替代方法出现以下错误
The new alternative gives the following error
usethis::create_package('NewPackage')
#New project 'NewPackage' is nested inside an existing project '/home/User/NewPackage/'
#This is rarely a good idea. Do you wish to create anyway?
#1: Negative
#2: I agree
#3: No way
我已经自动创建了包,但是这个新功能破坏了我所有包中的代码。
I had automated my package creation, but this new function breaks the code in all of my packages.
我将其发布为错误
但是我仍在寻找解决方法或以任何方式自动提交我同意
?
But I am still looking for a work around or any way to automatically submit I agree
?
还有一些隐藏文件,例如 .Rd2pdf12059
,在我的 / home / User / NewPackage /
目录中
There are also hidden files, such as .Rd2pdf12059
, in my /home/User/NewPackage/
directory
在此问题得到解决之前,我只是复制了旧的devtools源代码,并删除了我不喜欢的代码。
Until this is fixed, I have just copied the old devtools source code and removed what I didn't like.
推荐答案
不是最干净的处理方式,但是您可以使用 testthat :: with_mock
欺骗 check_not_nested
:
Not the cleanest way of doing things, but you could use testthat::with_mock
to trick check_not_nested
:
testthat::with_mock(
check_not_nested = function(path, name) return(),
usethis::create_package('NewPackage2'),
.env = "usethis"
)
这篇关于如何创建嵌套在git目录中的R包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!