Skip to content
Prev 894 / 12125 Next

[R-pkg-devel] Force namespace prefix for a loaded package function

On 27/06/2016 5:46 PM, Tim Keitt wrote:
It makes a little more sense, but it's still not correct.  If you want 
to do the equivalent of importing foo::options, just add the line

options <- foo::options

at the start of your script.  This "imports" that one function, and 
nothing else from the foo namespace.

It has the side effect of leaving the options object in the current 
workspace afterwards.  If that concerns you, use local():

local( {
   options <- foo::options
   # Lots of calculations, computing result
   result
})

Duncan Murdoch