[Rd] Dependency problem for "hasArg"
edd at debian.org
Mon Jul 2 19:19:59 CEST 2012
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())'
|  ".GlobalEnv" "Autoloads" "package:base"
| edd at max:~$ r -lmethods -e'print(search())'
|  ".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")'
edd at max:~$ time r -lmethods -e 'q("no")'
edd at max:~$ time Rscript -e 'q("no")'
edd at max:~$
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the R-devel