I nest my R packages inside of a github package with the same name. I had automated my package creation, but the new usethis::create_package that replaces devtools::setup( check=F) produces an input screen that breaks my scripts. I have asked for help finding a workaround at https://stackoverflow.com/questions/53819291/how-to-create-an-r-package-that-is-nested-in-another-project , but I consider this a bug.
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
Do you use usethis for anything other than package creation? I would predict that many things will break if the top-level of the git repo != top-level of the package (!= top-level of the RStudio Project, if you use RStudio).
I suspect we will have to say that usethis doesn't explicitly support this directory structure and that you should use a workaround. I.e. create the package in a non-nested location, then move it.
I just created a new RStudio project -- not package -- and, within that, did this:
testthat::with_mock(
`usethis:::check_not_nested` = function(path, name) NULL,
create_package("nestedpkg", rstudio = FALSE, open = FALSE)
)
which succeeds. Presumably you could use your favourite mocking package or function for this.
usethis is quite opinionated about workflow and we tool around this:
If you want to use usethis in a different scenario, I think you will need to strategically apply mocking strategies, such as the one I suggest above or in my first comment.
I have a git repository in ~/, which holds my dotfiles (configuration files, eg .gitconfig, .bashrc). This tends to make usethis think that the project root is in ~.
It seems heavy-handed to have such strong assumptions about how users may utilise git (or SVN) in combination with your package.
Most helpful comment
I have a git repository in
~/, which holds my dotfiles (configuration files, eg.gitconfig,.bashrc). This tends to make usethis think that the project root is in~.It seems heavy-handed to have such strong assumptions about how users may utilise git (or SVN) in combination with your package.