Re: [R-pkg-devel] Example fails in check

2019-07-26 Thread Jeff Newmiller
Pipes are very functional, unlike data.table. However, their extensive use of 
non-standard evaluation a la `subset` or `with` does complicate the package 
check process.

As to the actual question, Imports announces that the magrittr package is a 
private dependency for your package. Users would have to load that package  if 
they wanted to use it also. Since examples are run as if they were the user, 
they are subject to that same constraint. The advantage of having Imports 
rather than Depends is that you have more flexibility to change which 
dependencies you use to achieve your goals as a package without affecting the 
functions that the user has to be prepared to use our avoid, and the user is on 
their own as to which packages they use.

On July 26, 2019 12:13:17 AM PDT, Uwe Ligges  
wrote:
>I'd suggest not to use pipes in package code, as the parser does not 
>know about them and hence debugging, error messages  are more 
>obfuscated.
>
>Why not use he functional way of R?
>
>
>For the question: I guess you do not have a corresponding entry in the 
>NAMESPACE file?
>
>Best,
>Uwe
>
>
>
>On 26.07.2019 08:37, 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.
>> 
>> 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

-- 
Sent from my phone. Please excuse my brevity.

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Example fails in check

2019-07-26 Thread Duncan Murdoch

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


Re: [R-pkg-devel] Example fails in check

2019-07-26 Thread Uwe Ligges
I'd suggest not to use pipes in package code, as the parser does not 
know about them and hence debugging, error messages  are more 
obfuscated.


Why not use he functional way of R?


For the question: I guess you do not have a corresponding entry in the 
NAMESPACE file?


Best,
Uwe



On 26.07.2019 08:37, 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.

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