I'd like to exclude the following ressources when building an R package via .Rbuildignore:
^.*\.Rproj$ ^\.Rproj\.user$ inst/examples inst/prof man-roxygen tests But I'm confused as sometimes it seems to work and sometimes it doesn't.
I'm guessing that it has to do whether I'm using devtools::build(), devtools::install() or whatever exactly happens when hitting SHFT + CTRL + B (or Build >> Build and Reload) in RStudio. 
The only relevant ressources I could find were this post leading to this issue, but I'm still not fully getting it.
This is what I tried:
Load all followed by Build and Reload via RStudio shortcuts:
This is what I see when calling list.files(file.path(R.home("library"), "mypackage")):
[1] "DESCRIPTION" "examples"    "help"        "html"        [5] "INDEX"       "Meta"        "NAMESPACE"   "prof"        [9] "R"       Load all followed by Build and Reload followed by devtools::install():
This is what I see when calling list.files(file.path(R.home("library"), "mypackage")):
 [1] "DESCRIPTION" "examples"    "help"        "html"         [5] "INDEX"       "Meta"        "NAMESPACE"   "prof"         [9] "R"           "tests"       devtools::load_all() followed by devtools::build() followed by devtools::install():
This is what I see when calling list.files(file.path(R.home("library"), "mypackage")):
 [1] "DESCRIPTION" "examples"    "help"        "html"         [5] "INDEX"       "Meta"        "NAMESPACE"   "prof"         [9] "R"           "tests"     Uncompressing the .tar.gz file and inspecting the directory content:
 [1] "DESCRIPTION" "man"          "NAMESPACE"  "R" devtools::load_all() followed by devtools::build(binary=TRUE) followed by devtools::install():
[1] "DESCRIPTION" "examples"    "help"        "html"        [5] "INDEX"       "Meta"        "NAMESPACE"   "prof"        [9] "R"           "tests"       Uncompressing the .zip file and inspecting the directory content:
[1] "DESCRIPTION" "examples"    "help"        "html"        [5] "INDEX"       "MD5"         "Meta"        "NAMESPACE"   [9] "prof"        "R"     Looking at this also gives me reason to believe that I'm still not fully understanding the differences between devtools::build(), devtools::install() and install.packages() after the package has been built ;-)
Session Info:
R version 3.1.1 (2014-07-10) Platform: x86_64-w64-mingw32/x64 (64-bit)  locale: [1] LC_COLLATE=German_Germany.1252  [2] LC_CTYPE=German_Germany.1252    [3] LC_MONETARY=German_Germany.1252 [4] LC_NUMERIC=C                    [5] LC_TIME=German_Germany.1252      attached base packages: [1] compiler  stats     graphics  grDevices utils     [6] datasets  methods   base       other attached packages: [1] mypackage_0.1.0.1  loaded via a namespace (and not attached):  [1] devtools_1.5    digest_0.6.4    evaluate_0.5.5   [4] httr_0.4        memoise_0.2.1   packrat_0.4.0.5  [7] parallel_3.1.1  RCurl_1.95-4.3  stringr_0.6.2   [10] tools_3.1.1     whisker_0.3-2   I'm using RStudio 0.98.978
The thing that works for me is to use devtools::build to make a source package, then install.packages. 
devtools::build() %>%    install.packages(repos = NULL, type = "source") Using devtools::build(binary = TRUE) does not work, since it calls R CMD INSTALL rather than R CMD build, which ignores .Rbuildignore files.  Likewise, RStudio's "Build & Reload" button uses R CMD INSTALL.
I was encountering a similar problem when using devtools::check_win_devel() and devtools::release().
For consistent behaviour, I have found that it helps to use regular expressions for all entries in .Rbuildignore.  This file would then become:
^.*\.Rproj$ ^\.Rproj\.user$ ^inst/examples ^inst/prof ^man\-roxygen ^tests The directories are then ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With