I am building an R package using devtools
, but find that load_all()
runs functions even when they are included in .Rbuildignore
via use_build_ignore()
. I've created a minimal package at https://github.com/adsteen/loadallfail/tree/master/R to illustrate the problem.
I created this package using devtools::create("loadallfail")
. Then added a single file, R/syntax_error.R
, with the following contents:
syntax_error <- function{
Next I opened the package project in RStudio and ran devtools::use_build_ignore("syntax_error")
When I run load_all()
I get the following error:
Loading loadallfail
Error in parse(text = lines, n = -1, srcfile = srcfile) :
/Users/andrewsteen/Documents/Rpkgs/loadallfail/R/syntax_error.R:1:26: unexpected '{'
1: syntax_error <- function {
I would expect that the package would load successfully because anything matching the pattern in .Rbuildignore
would not load and therefore not cause problems. What am I misunderstanding?
Note: a similar question is posted at Rbuildignore and Excluding Directories, but in that question the problem seemed to be an RStudio bug. I am using RStudio, but am calling all the devtools
functions via the RStudio console (and in any case I can verify that .Rbuildignore
looks like I think it should.)