Skip to content
Prev 278211 / 398503 Next

On-demand importing of a package

On 11/22/2011 01:16 PM, G?bor Cs?rdi wrote:
No need to Depend:. Use

Imports: Matrix

plus in the NAMESPACE file

  importFrom(Matrix, rowSums)

Why do you not want to do this? Matrix is available for everyone, 
Imports: doesn't influence the package search path. There is a cost 
associated with loading the library in the first place, but...?
I'm more into black-and-white -- it either needs Matrix or not; 
apparently it does.
In another message you mention

 > Matrix:::rowSums(W)
Error in callGeneric() :
   'callGeneric' must be called from a generic function or method

but something else is going on -- you don't get to call methods 
directly; you're getting Matrix::rowSums (it's exported, so no need for 
a :::, see getNamespaceExports("Matrix")). Maybe traceback() after the 
error would be insightful?

Martin