Skip to content
Prev 54526 / 63424 Next

Rscript fails with some packages (for example, h5)

On 26/12/2017 9:40 AM, Dirk Eddelbuettel wrote:
Mostly irrelevant correction of the jargon:  that setting controls which 
packages are "attached" by default.  library(h5) would be enough to load 
methods, because h5 imports things from methods.  But loading doesn't 
put a package on the search list.  library(methods) both loads methods 
(if it hasn't already been loaded), and attaches it.
That's not quite true (or quite English, as per fortune(112)).  The 
"gmp" package imports methods, and it works in Rscript.  What doesn't 
work is to expect library(h5) or library(gmp) to cause methods functions 
like show() to be available to the user.

There is a way to do that, but it is discouraged nowadays. My ancient 
package "orientlib" depends on methods, and that forces methods to be 
attached so show() works in Rscript.  ("Depends" is used in the 
DESCRIPTION file sense.)  h5 doesn't "depend" on methods, it "imports" 
methods.
And that's still true, and less irrelevant than my corrections.

Duncan Murdoch