Building binary package R - r

I am new to R and I am trying to make a standalone executable so that my scripts can be run without development tools. I have created multiple R scripts containing different functions and have been using a main.r script to connect the other scripts. I have been using RStudio and using Source on each file to add them to the Global Environment and finally using Source on my main file to start executing my program. When attempting to build a binary package through:
Build > Build Binary Package
I was getting the error:
ERROR: The build directory does not contain a DESCRIPTION
file so cannot be built as a package.
So I created a package and now the error I get is
** preparing package for lazy loading
Error in reorderPopulation(pop_fitness_list) :
could not find function "reorderPopulation"
Error : unable to load R code in package 'EAtsp'
ERROR: lazy loading failed for package 'EAtsp'
* removing 'C:/Users/Ryan/AppData/Local/Temp/RtmpsXbv0j/temp_libpath27ec59515c59/EAtsp'
Error: Command failed (1)
Execution halted
Exited with status 1.
Can someone explain to me how to fix this problem?
EDIT: I have since added roxygen comments to each of my functions and they are all displaying within the NAMESPACE file but still have the same issue.
These are the files my R directory contains:
fitness.r
initDataset.r
main.r
operators.r
selection.r
The functions within fitness.r can be found from main.r with no problem so I moved the reorderPopulation function which was previously in selection.r to fitness.r and it can be found. Why can the functions inside the selection.r file and possibly the others not be found?

There's nothing reproducible, so I'll go through a hacked example that works, perhaps you can use it as a template for explaining what is different and why yours should still work.
./DESCRIPTION
Package: Porteous96
Title: This package does nothing
Version: 0.0.0.9000
Authors#R: person('r2evans', email='r2evans#ignore.stackoverflow.com', role=c('aut','cre'))
Description: This package still does nothing
Depends: R (>= 3.3.3)
License: MIT
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
(Go ahead and try to send an email there ... I don't think it'll bug me ...)
./NAMESPACE
After create:
# Generated by roxygen2: fake comment so roxygen2 overwrites silently.
exportPattern("^[^\\.]")
After document:
# Generated by roxygen2: do not edit by hand
export(reorderPopulation)
(Regardless, this file needs no manually editing, assuming you are either using roxygen2 with its #' #export clause, or you are using the default "export almost everything" without roxygen2.)
./R/reorderPopulation.R
#' Do or do not
#'
#' (There is no try.)
#' #param ... any arguments ultimately ignored
#' #return nothing, invisibly
#' #export
reorderPopulation <- function(...) {
cat("do nothing\n")
invisible(NULL)
}
unorderPopulation <- function(...) {
reorderPopulation()
cat("should not be found\n")
invisible(NULL)
}
./R/zzz.R
I added this file just to try to "find" one of the exported functions from within this package.
.onLoad <- function(libname, pkgname) {
reorderPopulation("ignored", "stuff")
}
I can get away with assuming the function is available, per ?.onLoad:
Note that the code in '.onLoad' and '.onUnload' should not assume
any package except the base package is on the search path.
Objects in the current package will be visible (unless this is
circumvented), but objects from other packages should be imported
or the double colon operator should be used.
Build and Execute
I actually started this endeavor with a template directory created by starting in the intended directory and running:
devtools::create(".")
# Creating package 'Porteous96' in 'C:/Users/r2/Projects/StackOverflow'
# No DESCRIPTION found. Creating with values:
# Package: Porteous96
# Title: What the Package Does (one line, title case)
# Version: 0.0.0.9000
# Authors#R: "My Real Name <myreal##email.address.com> [aut,cre]"
# Description: What the package does (one paragraph).
# Depends: R (>= 3.3.3)
# License: Call for information, please
# Encoding: UTF-8
# LazyData: true
# * Creating `Porteous96.Rproj` from template.
# * Adding `.Rproj.user`, `.Rhistory`, `.RData` to ./.gitignore
However, you can easily just use the samples I provided above and move forward without calling create. (It also includes some other files, e.g., ./.gitignore, ./Porteous96.Rproj, and ./.Rbuildignore, none of which are required in the rest of my process here. If you have them and they have non-default values, that might be good to know.)
From there, I edited/created the above files, then:
devtools::document(".")
# Updating Porteous96 documentation
# Loading Porteous96
# do nothing
# First time using roxygen2. Upgrading automatically...
# Writing NAMESPACE
# Writing reorderPopulation.Rd
(The reason you see "do nothing" above and below is that I put it in a function named .onLoad, triggered each time the library is loaded. This includes during devtools::document and devtools::install as well as the obvious library(Porteous96).
One side-effect of that is that a ./man/ directory is created with the applicable help files. In this case, a single file, reorderPopulation.Rd, no need to show it here.
devtools::install(".")
# Installing Porteous96
# "c:/R/R-3.3.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore \
# --quiet CMD INSTALL "C:/Users/r2/Projects/StackOverflow/Porteous96" \
# --library="C:/Users/r2/R/win-library/3.3" --install-tests
# * installing *source* package 'Porteous96' ...
# ** R
# ** preparing package for lazy loading
# ** help
# *** installing help indices
# ** building package indices
# ** testing if installed package can be loaded
# *** arch - i386
# do nothing
# *** arch - x64
# do nothing
# * DONE (Porteous96)
# Reloading installed Porteous96
# do nothing
For good measure, I close R and re-open it. (Generally unnecessary.)
library(Porteous96)
# do nothing
(Again, this is dumped to the console because of .onLoad.)
reorderPopulation()
# do nothing
unorderPopulation()
# Error: could not find function "unorderPopulation"
Porteous96:::unorderPopulation()
# do nothing
# should not be found
Wrap-Up
I'm guessing this does not solve your problem. It highlights about as much as I could glean from your question(s). Perhaps it provides enough framework where you can mention salient differences between my files and yours. Though answers are not meant for pre-solution discussion, I think it is sometimes necessary and useful.

After help from #r2evans I have managed to find a solution to the problem.
My main.r file was just a bunch of function calls with no function wrapping them. So I wrapped the function calls in a function and the function now looks as follows:
mainFunction <- function() {
source("R/initSetup.r")
initSetup()
...
}
initSetup.r contains more source() calls to the other files that I use. The program is then run using the command mainFunction() in the R console

Related

Behavior of `R CMD build` depending of Rd content

R CMD build behaves differently whether a Rd file contains \PR{} or not. See Writing R Extensions for details on the macros.
Example when a Rd file does not contain \PR{}:
$ R CMD build test
* checking for file 'test/DESCRIPTION' ... OK
* preparing 'test':
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
* saving partial Rd database
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'test_0.1.tar.gz'
Example when a Rd file contains \PR{}:
$ R CMD build test
* checking for file 'test/DESCRIPTION' ... OK
* preparing 'test':
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
* saving partial Rd database
* building the PDF package manual # <- this
Hmm ... looks like a package # <- this
Converting Rd files to LaTeX # <- this
Creating pdf output from LaTeX ... # <- this
Saving output to 'xxx/test.pdf' ... # <- this
Done # <- this
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'test_0.1.tar.gz'
The additional stage (i.e. building the PDF package manual, which can be quite slow on an old computer...) is due to the call to ..Rd2pdf in .build_packages (lines 619-625). However I do not understand what triggers this stage. In addition, it is triggered only for \PR{} and not for other macros such as \CRANpkg{} and \doi{}.
Can someone trace back what happens and why? The question is on base R functions only. I do not use helpers such as devtools.
Minimal test package
Package structure
test
test/man
test/man/one.Rd
test/R
test/R/one.R
test/DESCRIPTION
test/NAMESPACE
test/man/one.Rd
\name{one}
\alias{one}
\title{Get One}
\description{
Rd file containing or not the PR macro:
\PR{1} % comment/uncomment this line as needed
but containing other macros:
\CRANpkg{ggplot2} and \doi{10.1002/wics.147}
}
\usage{
one()
}
test/R/one.R
one <- function() 1
test/DESCRIPTION
Package: test
Version: 0.1
Title: Test
Author: Nobody
Maintainer: Nobody <no#body.org>
Description: Test.
License: GPL-3
test/NAMESPACE
export(one)
Build, check, and install with:
$ R CMD build test
$ R CMD check test_0.1.tar.gz
$ R CMD INSTALL test_0.1.tar.gz
Here's an explanation of the mechanism that led to this difference.
You can see the system macro definitions in the file at file.path(R.home(), "share/Rd/macros/system.Rd"). The definition for \PR is
\newcommand{\PR}{\Sexpr[results=rd]{tools:::Rd_expr_PR(#1)}}
The definitions for the others you mention are
\newcommand{\CRANpkg}{\href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}}
\newcommand{\doi}{\Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("#1")}}
The \CRANpkg macro doesn't execute R code, so it doesn't trigger a package install.
The \doi macro executes code at build time.
Just above the code you linked, you see this test:
needRefman <- manual &&
parse_description_field(desc, "BuildManual", TRUE) &&
any(vapply(db,
function(Rd)
any(getDynamicFlags(Rd)[c("install", "render")]),
NA))
The manual variable defaults to TRUE, but the command line option --no-manual sets it to FALSE. The next part of the test says you can suppress the manual by a field in the DESCRIPTION file.
The getDynamicFlags() function is looking for code in Rd files executed at install or render time, not build time, so the \doi macro doesn't trigger the build of the reference manual.
The \PR macro doesn't specify the stage when it runs, and the documentation seems silent on the default run time, but apparently getDynamicFlags(Rd)[c("install", "render")] returns TRUE for it. I'd guess the default is render time, in case the URL for the bug database changes in some future version of R. [Edit: the docs do say that the default is "install".]
So to suppress this build, put BuildManual: false in the DESCRIPTION file or --no-manual on the R CMD build command line.
Response from R-core on R's Bugzilla:
The \PR macro has initially been used exclusively in R's own NEWS.Rd, where
stage does not really apply.
The stage=install default for Sexpr's probably has historical reasons: build
was implemented later. I agree that stage=build is usually preferable in
non-base packages to avoid blowing up the tarball with the PDF manual. A
partial Rd db is often included anyway because of the \doi macro.
I haven't checked if/how we could modify the PR macro without breaking NEWS.Rd
processing. Note that the macro is mentioned in WRE only as an example for
\newcommand; I don't think it is of general use. It is unclear to which bug
tracker a "PR#" would refer to in the help of a contributed package. It may be
better to simply include the plain URL to a bug report here.
If you'd still like to use it, you could set \RdOpts{stage=build} at the
beginning of the Rd file. (This requires R >= 4.1.0 due to Bug 18073.)

How do I resolve Rd warning "missing file link" when building packages in RStudio?

After building a simple test package to isolate this issue, I receive the following warning when I run Rcmd.exe INSTALL --nomultiarch --with-keep.source simpleTest:
* installing to library 'C:/Users/user/Documents/R-dev'
* installing *source* package 'simpleTest' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
converting help for package 'simpleTest'
finding HTML links ... hello html
Rd warning: C:/user/RPackages/simpleTest/man/hello.Rd:11: missing file link 'transmute'
done
** building package indices
** testing if installed package can be loaded
* DONE (simpleTest)
The issue occurs when you link to functions that point to an Rd file of a different name. For example, in my simpleTest package, the documentation links to both dplyr::mutate() and dplyr::transmute(), both of which are documented in the mutate.Rd file. The former link does not cause the Rd warning, while the latter does. However, both links work when you look at the help page for the current package.
The .R file for the simpleTest package is included below. I run devtools::document() and then build the package in a skeleton package directory.
hello.R
#' print hello
#'
#' This does something less complicated than \code{\link[dplyr:mutate]{dplyr::mutate()}}
#' and \code{\link[dplyr:transmute]{dplyr::transmute()}}.
#' #export
hello <- function() {
print("Hello, world!")
}
This is because the links are created based on the names of the files, not the aliases. If you just use \link{foo}, foo is a topic (and hence you can use aliases without problem). The moment however you use any of the forms :
\link[pkg]{foo}
\link[pkg:foo]{bar}
foo needs to be a file and hence you can only use the name and not the alias. If you check ?dplyr::mutate, you see that mutate is the name (upper left corner) and transmute is an alias. So when you try to use the alias the link will (likely) work, but you will see the warning you saw.
To avoid that, you need :
\link[dplyr:mutate]{dplyr::transmute()}
For reference: https://cran.r-project.org/doc/manuals/R-exts.html#Cross_002dreferences

How to use other R scripts within my package [duplicate]

I am new to R and I am trying to make a standalone executable so that my scripts can be run without development tools. I have created multiple R scripts containing different functions and have been using a main.r script to connect the other scripts. I have been using RStudio and using Source on each file to add them to the Global Environment and finally using Source on my main file to start executing my program. When attempting to build a binary package through:
Build > Build Binary Package
I was getting the error:
ERROR: The build directory does not contain a DESCRIPTION
file so cannot be built as a package.
So I created a package and now the error I get is
** preparing package for lazy loading
Error in reorderPopulation(pop_fitness_list) :
could not find function "reorderPopulation"
Error : unable to load R code in package 'EAtsp'
ERROR: lazy loading failed for package 'EAtsp'
* removing 'C:/Users/Ryan/AppData/Local/Temp/RtmpsXbv0j/temp_libpath27ec59515c59/EAtsp'
Error: Command failed (1)
Execution halted
Exited with status 1.
Can someone explain to me how to fix this problem?
EDIT: I have since added roxygen comments to each of my functions and they are all displaying within the NAMESPACE file but still have the same issue.
These are the files my R directory contains:
fitness.r
initDataset.r
main.r
operators.r
selection.r
The functions within fitness.r can be found from main.r with no problem so I moved the reorderPopulation function which was previously in selection.r to fitness.r and it can be found. Why can the functions inside the selection.r file and possibly the others not be found?
There's nothing reproducible, so I'll go through a hacked example that works, perhaps you can use it as a template for explaining what is different and why yours should still work.
./DESCRIPTION
Package: Porteous96
Title: This package does nothing
Version: 0.0.0.9000
Authors#R: person('r2evans', email='r2evans#ignore.stackoverflow.com', role=c('aut','cre'))
Description: This package still does nothing
Depends: R (>= 3.3.3)
License: MIT
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
(Go ahead and try to send an email there ... I don't think it'll bug me ...)
./NAMESPACE
After create:
# Generated by roxygen2: fake comment so roxygen2 overwrites silently.
exportPattern("^[^\\.]")
After document:
# Generated by roxygen2: do not edit by hand
export(reorderPopulation)
(Regardless, this file needs no manually editing, assuming you are either using roxygen2 with its #' #export clause, or you are using the default "export almost everything" without roxygen2.)
./R/reorderPopulation.R
#' Do or do not
#'
#' (There is no try.)
#' #param ... any arguments ultimately ignored
#' #return nothing, invisibly
#' #export
reorderPopulation <- function(...) {
cat("do nothing\n")
invisible(NULL)
}
unorderPopulation <- function(...) {
reorderPopulation()
cat("should not be found\n")
invisible(NULL)
}
./R/zzz.R
I added this file just to try to "find" one of the exported functions from within this package.
.onLoad <- function(libname, pkgname) {
reorderPopulation("ignored", "stuff")
}
I can get away with assuming the function is available, per ?.onLoad:
Note that the code in '.onLoad' and '.onUnload' should not assume
any package except the base package is on the search path.
Objects in the current package will be visible (unless this is
circumvented), but objects from other packages should be imported
or the double colon operator should be used.
Build and Execute
I actually started this endeavor with a template directory created by starting in the intended directory and running:
devtools::create(".")
# Creating package 'Porteous96' in 'C:/Users/r2/Projects/StackOverflow'
# No DESCRIPTION found. Creating with values:
# Package: Porteous96
# Title: What the Package Does (one line, title case)
# Version: 0.0.0.9000
# Authors#R: "My Real Name <myreal##email.address.com> [aut,cre]"
# Description: What the package does (one paragraph).
# Depends: R (>= 3.3.3)
# License: Call for information, please
# Encoding: UTF-8
# LazyData: true
# * Creating `Porteous96.Rproj` from template.
# * Adding `.Rproj.user`, `.Rhistory`, `.RData` to ./.gitignore
However, you can easily just use the samples I provided above and move forward without calling create. (It also includes some other files, e.g., ./.gitignore, ./Porteous96.Rproj, and ./.Rbuildignore, none of which are required in the rest of my process here. If you have them and they have non-default values, that might be good to know.)
From there, I edited/created the above files, then:
devtools::document(".")
# Updating Porteous96 documentation
# Loading Porteous96
# do nothing
# First time using roxygen2. Upgrading automatically...
# Writing NAMESPACE
# Writing reorderPopulation.Rd
(The reason you see "do nothing" above and below is that I put it in a function named .onLoad, triggered each time the library is loaded. This includes during devtools::document and devtools::install as well as the obvious library(Porteous96).
One side-effect of that is that a ./man/ directory is created with the applicable help files. In this case, a single file, reorderPopulation.Rd, no need to show it here.
devtools::install(".")
# Installing Porteous96
# "c:/R/R-3.3.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore \
# --quiet CMD INSTALL "C:/Users/r2/Projects/StackOverflow/Porteous96" \
# --library="C:/Users/r2/R/win-library/3.3" --install-tests
# * installing *source* package 'Porteous96' ...
# ** R
# ** preparing package for lazy loading
# ** help
# *** installing help indices
# ** building package indices
# ** testing if installed package can be loaded
# *** arch - i386
# do nothing
# *** arch - x64
# do nothing
# * DONE (Porteous96)
# Reloading installed Porteous96
# do nothing
For good measure, I close R and re-open it. (Generally unnecessary.)
library(Porteous96)
# do nothing
(Again, this is dumped to the console because of .onLoad.)
reorderPopulation()
# do nothing
unorderPopulation()
# Error: could not find function "unorderPopulation"
Porteous96:::unorderPopulation()
# do nothing
# should not be found
Wrap-Up
I'm guessing this does not solve your problem. It highlights about as much as I could glean from your question(s). Perhaps it provides enough framework where you can mention salient differences between my files and yours. Though answers are not meant for pre-solution discussion, I think it is sometimes necessary and useful.
After help from #r2evans I have managed to find a solution to the problem.
My main.r file was just a bunch of function calls with no function wrapping them. So I wrapped the function calls in a function and the function now looks as follows:
mainFunction <- function() {
source("R/initSetup.r")
initSetup()
...
}
initSetup.r contains more source() calls to the other files that I use. The program is then run using the command mainFunction() in the R console

Error while importing mice functions in R package

I would like to include the mice::mice function in my package to perform imputation on my data.
I use Roxygen to list imports
#' #param data dataset to be used for imputation
#' #importFrom dplyr select_
#' #importFrom mice mice complete
#' #return A list
#' #export
#'
impute_data <- function(data, vars, seed)
{
data_used <- select_(data,vars)
mice_data <- complete(mice(data_used, seed = seed))
return(mice_data)
}
This function works fine when I test the code, however when I build the package and try to use it, I get the following error
Error in check.method(setup, data) :
The following functions were not found: mice.impute.pmm,mice.impute.pmm, mice.impute.pmm, mice.impute.pmm, mice.impute.pmm
I tried to add to the imports all the functions mentioned in the error but it had no effect whatsoever on the outcome.
What am I missing? I've never found such a problem.
You are forgetting to handle the DESCRIPTION file! You only handle impute_data.R.
Your question is quite similar to:
What roxygen should I put when I use a function of another package in my function
I gave answer there (Please search for similar questions before posting any question). For your case:
First, being aware of your
sessionInfo()
getwd() # your R's working directory
.libPaths() # your R's library location
Step0 Download and install the necessary packages:
library(roxygen2)
library(devtools)
library(digest)
Step1 Put all your related ".R" files (yourfunction1.R, yourfunction2.R, yourfunction3.R, impute_data.R) to your R's working directory.
Step2 Create your package skeleton in your R's working directory:
Be sure that there is no folder named "yourpackage" in your R's working directory before running the following command. (from R's console)
package.skeleton(name = "yourpackage", code_files = c("yourfunction1.R", "yourfunction2.R", "yourfunction3.R", "impute_data.R"), path = ".")
After running package.skeleton, the folder yourpackage is created in your R's Working Directory.
Delete Read-and-delete-me file from Windows Explorer.
Delete "yourpackage-package.Rd" file in YourR'sWorkingDirectory\yourpackage\man folder
(Do NOT delete "yourpackage.Rd" file in YourR'sWorkingDirectory\yourpackage\man folder!)
Step3 At the end of the preamble of your ".R" file (impute_data.R), put the following (if you had not done it so in Step1):
#' #importFrom mice mice
#' #importFrom mice complete
#' #export
impute_data <- function(...) {...
Step4 In the DESCRIPTION file of your package, in the Imports part, add:
Imports:
mice(>= VersionNumber)
where VersionNumber is the version number of the mice package you are using. You can find the version number by right-click any function (from yourpackage) in Object Browser of RevolutionREnterprise; and going the bottom of the resultant .html help file. There, the version number of the package is shown.
In Step2, package.skeleton automatically produced a NAMESPACE file whose content is:
exportPattern("^[[:alpha:]]+")
Do not handle this NAMESPACE file manually.
Step5 roxygenize the package you wanna create ("yourpackage")
library(roxygen2)
roxygenize("yourpackage")
Upon roxygenization, the content of the NAMESPACE file of yourpackage is automatically converted from exportPattern("^[[:alpha:]]+") to
# Generated by roxygen2: do not edit by hand
export(impute_data)
importFrom(mice,mice)
importFrom(mice,complete)
Step6 Build your package:
(first, delete "src-i386" and "src-x64" folders (if any) in YourR'sWorkingDirectoryFolder\yourpackage folder from Windows Explorer)
(Be sure again that there is no "yourpackage-package.Rd" file in YourR'sWorkingDirectory\yourpackage\man folder. If there is, delete it before building)
build("yourpackage")
Step7 Install your package:
install("yourpackage")
Step8 Check that all is going well by loading your package and running a function in the package.
library(yourpackage)
impute_data(a,b,1235) # "impute_data" is the function in the package "yourpackage"
Step9 Check that your package is loadable to CRAN (Comprehensive R Archieve Network) (if you wanna share your package):
(first, delete "src-i386" and "src-x64" folders (if any) in YourR'sWorkingDirectoryFolder\yourpackage folder from Windows Explorer)
(Be sure again that there is no "yourpackage-package.Rd" file in YourR'sWorkingDirectory\yourpackage\man folder. If there is, delete it before checking)
From DOS Command Prompt:
Start – cmd - Enter. Pass to R's working directory (your R's working directory is known via getwd()) and do CRAN check:
cd C:\Users\User\Documents\Revolution
R CMD check yourpackage
From R's console:
devtools::check("C:/Users/User/Documents/Revolution/yourpackage")
Hello and even if the post is older,
recently, I came across the same problem and the proposed solutions by
Erdogan CEVHER and mickkk did not work for me. I solved it by actively loading the mice package, while loading my own package. For more detailed information consult R-Package-Dependencies.
In addition to the steps required during package development, here is what I recommend:
Part 1: Add mice to the Depends: (not Import:) field in the DESCRIPTION file of your package.
Depends: mice (>= VERSIONNUMBER)
Part 2: Use import(mice) in NAMESPACE (only for devtools::check())
import(mice)
Part 3: Reference each function using mice::, for example
mice::mice(data, method="pmm")

character(0) warnings when running devtools::load_all(".") in RStudio

I have an R package that I've been building in RStudio, let's called it my_pkg. When I run devtools::load_all(".") within RStudio (specifically using the Ctrl + Shift + L shortcut), I get the following message:
Loading my_pkg
Warning messages:
1: character(0)
2: character(0)
3: character(0)
4: character(0)
5: character(0)
All of the functions in the package work fine. My NAMESPACE and DESCRIPTION files are complete with no syntax errors. When I run ?my_pkg, however, the help file does not match the specifications provided in the DESCRIPTION file. When I remove the Imports from DESCRIPTION, there is no more character(0) warning message. Of course, I need those imports. When I change Imports to Suggests, there is character(0) warning message.
Here is the description file content, with some stuff changed to protect IP.
Package: scoutdroid
Title: This is where the title is.
Version: 0.1
Authors#R: "Ben Hanowell <benjamin.hanowell#redfin.com> [aut, cre]"
Description: This is where the description is.
Depends:
R (>= 3.1.0)
Imports:
dplyr,
lubridate,
mboost,
randomForestSRC,
RODBC,
stringr
License: file LICENSE
LazyData: true
And here is NAMESPACE.
# Generated by roxygen2 (4.0.1): do not edit by hand
import(RODBC)
import(dplyr)
import(lubridate)
import(mboost)
import(parallel)
import(randomForestSRC)
import(stringr)
When I use the RStudio Build & Reload button in the Build tab, I get the following warnings:
** preparing package for lazy loading
Warning: replacing previous import by 'lubridate::intersect' when loading 'scoutdroid'
Warning: replacing previous import by 'lubridate::setdiff' when loading 'scoutdroid'
Warning: replacing previous import by 'lubridate::union' when loading 'scoutdroid'
edit Added some more details to help folks understand what might be going on.
edit 2 I also added the DESCRIPTION file, although I don't provide the full package, which is proprietary.
edit 3 Added NAMESPACE.
edit 4 Added warnings that occur when using RStudio Build & Reload button in the Build tab.
After some dialoge in the comments, we figured out that the empty warnings that load_all is giving you are actually initiated when loading the package because of function name conflicts.
The issue is that you are importing a function from a package, then overwriting that function. When that happens R throws warnings as you saw when you clicked "Build & Reload" in RStudio:
Warning: replacing previous import by 'lubridate::intersect' when loading 'scoutdroid'
Warning: replacing previous import by 'lubridate::setdiff' when loading 'scoutdroid'
Warning: replacing previous import by 'lubridate::union' when loading 'scoutdroid'
It looks like load_all may be attempting to muffle those warnings (just a guess) which is why you see character(0) instead of the actual warnings. (These particular warnings are difficult to silence.)
It is generally not a good idea to import an entire package's namespace. You should instead import only the symbols you need. See this post of mine for more.
The solution is to use importFrom instead of import in your NAMESPACE file.
It can also be due to a broken link in the roxygen2 documentation. For example when you link to a function external to your package with the wrong name, say \link[stringi]{STRI_C} instead of \link[stringi]{stri_c}

Resources