[Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-10 Thread Kirill Müller
Hi Accesses the $new method for a class defined in a package fails if the methods package is not loaded. I have created a test package with the following single code file: newTest <- function() { cl <- get("someClass") cl$new } someClass <- setRefClass("someClass") (This is similar to

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-10 Thread Peter Meilstrup
Because "depends" is treated incorrectly (if I may place a value judgement on it). I had an earlier thread on this, not sure if any changes have taken place since then: http://r.789695.n4.nabble.com/Dependencies-of-Imports-not-attached-td4666529.html On Mon, Feb 10, 2014 at 5:53 PM, Kirill Müller

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-10 Thread Kirill Müller
On 02/11/2014 03:22 AM, Peter Meilstrup wrote: Because "depends" is treated incorrectly (if I may place a value judgement on it). I had an earlier thread on this, not sure if any changes have taken place since then: http://r.789695.n4.nabble.com/Dependencies-of-Imports-not-attached-td4666529.htm

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-10 Thread Dirk Eddelbuettel
On 11 February 2014 at 02:53, Kirill Müller wrote: | Why does it seem to be necessary to load the methods package here? "Just use littler (TM pending)". It (auto-)load methods automagically, thanks to Jeff Horner. See below. edd@max:~$ chmod 0755 /tmp/kirill.r edd@max:~$ /tmp/kirill.r

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-11 Thread Winston Chang
To state the issue that Kirill raised in a different way... A package with S4 or reference classes and Depends:methods can throw an error when you do something as simple as this: Rscript -e "mypackage::foo()" But this will work: Rscript -e "library(mypackage); foo()" This is because when mypa

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-11 Thread Duncan Murdoch
On 11/02/2014 12:06 PM, Winston Chang wrote: To state the issue that Kirill raised in a different way... A package with S4 or reference classes and Depends:methods can throw an error when you do something as simple as this: Rscript -e "mypackage::foo()" But this will work: Rscript -e "libr

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-11 Thread Martin Morgan
On 02/11/2014 09:06 AM, Winston Chang wrote: To state the issue that Kirill raised in a different way... A package with S4 or reference classes and Depends:methods can throw an error when you do something as simple as this: Rscript -e "mypackage::foo()" But this will work: Rscript -e "libr

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-11 Thread Simon Urbanek
On Feb 11, 2014, at 1:28 PM, Martin Morgan wrote: > On 02/11/2014 09:06 AM, Winston Chang wrote: >> To state the issue that Kirill raised in a different way... A package >> with S4 or reference classes and Depends:methods can throw an error >> when you do something as simple as this: >> Rscrip

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-12 Thread Winston Chang
On Tue, Feb 11, 2014 at 3:27 PM, Simon Urbanek wrote: > > I suspect the problem could be classified as bug in methods which doesn't > behave correctly if not attached. I didn't look into details, but there used > to be a technical problem in R C API where you could not pass the right > environm