Re: [Rd] Dependency problem for "hasArg"

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Mon, 02 Jul 2012 12:19:59 -0500

On 2 July 2012 at 12:00, Dirk Eddelbuettel wrote:
|
| On 2 July 2012 at 09:23, Charlie Friedemann wrote:
| | The error message you are getting makes it rather clear what the problem is.
| | R is unable to find the function 'hasArg'. As the hasArg function is part
| | of the package 'methods', a solution would be to put require(methods) at the
| | beginning of your script.

| |
| | For whatever reason, loading R via Rscript does not load the base package
| | "methods" whereas loading the R console does. I'm not entirely sure why this
| | is the case, and I'm sure someone who knows more about the differences
| | between the two could chime in here.
|
| That was a design decision in Rscript as loading 'methods' is slow. And
| FWIW, littler does the same:
|
| edd_at_max:~$ r -e'print(search())'
| [1] ".GlobalEnv" "Autoloads" "package:base"
| edd_at_max:~$ r -lmethods -e'print(search())'
| [1] ".GlobalEnv" "package:methods" "Autoloads" "package:base"
| edd_at_max:~$

Maybe I should revisit this, though, as littler beats Rscript even when loading methods --- and I could then argue that little is less confusing :)

edd_at_max:~$ time r -e 'q("no")'

real	0m0.366s
user	0m0.604s
sys	0m0.304s

edd_at_max:~$ time r -lmethods -e 'q("no")'
real	0m0.420s
user	0m0.648s
sys	0m0.476s

edd_at_max:~$ time Rscript -e 'q("no")'
real	0m0.485s
user	0m0.712s
sys	0m0.544s

edd_at_max:~$

Dirk

-- 
Dirk Eddelbuettel | edd@debian.org | http://dirk.eddelbuettel.com

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 02 Jul 2012 - 17:22:53 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 02 Jul 2012 - 21:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive