Re: [R-pkg-devel] loadMethod() not available with Rscript

2017-09-21 Thread Dirk Eddelbuettel
On 20 September 2017 at 16:44, Martyn Plummer wrote: | On Wed, 2017-09-20 at 09:45 -0500, Dirk Eddelbuettel wrote: | > Thierry, | > | > This has always been a considerable puzzle, and the source of some amusement, | > to me. It is a clear design bug in Rscript because _code that would | > other

Re: [R-pkg-devel] loadMethod() not available with Rscript

2017-09-20 Thread Martyn Plummer
On Wed, 2017-09-20 at 09:45 -0500, Dirk Eddelbuettel wrote: > Thierry, > > This has always been a considerable puzzle, and the source of some amusement, > to me. It is a clear design bug in Rscript because _code that would > otherwise work_ will not if it happens to rely on library(methods). S4 c

Re: [R-pkg-devel] loadMethod() not available with Rscript

2017-09-20 Thread Dirk Eddelbuettel
Thierry, This has always been a considerable puzzle, and the source of some amusement, to me. It is a clear design bug in Rscript because _code that would otherwise work_ will not if it happens to rely on library(methods). S4 comes to mind. This has also been answered at least a few times on SO

Re: [R-pkg-devel] loadMethod() not available with Rscript

2017-09-20 Thread Thierry Onkelinx
Dear Joshua, Thanks for your prompt reply. I had a look at all dependencies and none of them use loadMethod(). So the culprit is probably one of their dependencies. What would be the best way to deal with this? add library(methods) to the script or import loadMethod() via the NAMESPACE? Best re

Re: [R-pkg-devel] loadMethod() not available with Rscript

2017-09-20 Thread Joshua Ulrich
Hi Thierry, On Wed, Sep 20, 2017 at 7:45 AM, Thierry Onkelinx wrote: > Dear all, > > Could someone explain this to me? I have a simple script (see below). > my_function() is an S4 method. The package imports all functions from > methods that it uses. > > When I run the script in a vanilla R sessi

[R-pkg-devel] loadMethod() not available with Rscript

2017-09-20 Thread Thierry Onkelinx
Dear all, Could someone explain this to me? I have a simple script (see below). my_function() is an S4 method. The package imports all functions from methods that it uses. When I run the script in a vanilla R session it works. When using Rscript I get the error: Error in loadMethod(function (x, .