On 26/07/2019 2:37 a.m., Sigbert Klinke wrote:
Hi,
im my package development I get the following error when checking an
example:
> m <- findMatch('test', x[[1]], FUN='leven(code)') %>% addWave(x[[2]])
Error in findMatch("test", x[[1]], FUN = "leven(code)") %>%
addWave(x[[2]]) :
could not find function "%>%"
Execution halted
In my DESCRIPTION file I wrote
Imports:
rio,
stringi,
magrittr
So, I expected that magrittr is loaded when the example is executed.
Loaded doesn't mean it is on the search list. To get that you need
library(magrittr), or require(magrittr).
Examples can't see things that are internal to the package. Importing a
package only makes it available internally. If you want it visible
externally (as it needs to be in an example), you need to export it.
So if you want users of your package to have access to magrittr pipes,
you should put something like this in your NAMESPACE file, as well as
the declaration in your DESCRIPTION file:
importFrom(magrittr, "%>%")
export("%>%")
Duncan Murdoch
If I add an "library(magrittr)" at the beginning of the example then the
example is okay.
Any ideas what goes wrong?
Sigbert
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel