I'm writing a package containing several functions to make running and evaluating models more streamlined.
I have a function that I'm going to make the first function within my package detailed with roxygen2 comments, which I can include into this write-up as an edit if necessary, but my issue is more with Package Creation.
I've created a separate .R
file for the function and it lives within the R
folder in within my package folder. I've run R CMD build pkgname
and R CMD INSTALL pkgname
successfully.
At the document()
stage I run it (from console or whether in my terminal using R -e 'library(devtools);document()'
, deleting the existing NAMESPACE
file first) and I get the following error: Try removing ‘/Library/Frameworks/R.framework/Versions/ 3.5/Resources/library/00LOCK-pkgname
.
I've already seen the [issue posted here][1] and haven't had success after deleting the 00LOCK-pkgname
folder, for two reasons: when I run document()
, even when it throws the above error, it doesn't stop running, it just keeps looping (that happens whether I run this in R or use the Terminal). Additionally, no matter how many times I delete the folder, it keeps re-appearing even though I've stopped running the function.
Any insight into why that error is being thrown and the document()
function continually runs in a loop?
Best answer I've found is in this blog post: Hilary Parker R-Package Blog Post
The steps I follow to document and install are as follows:
setwd('..')
devtools::document()
devtools::install()
This works for me when initially installing my package and also updating it.