[Rd] search for variable in package in .GlobalEnv first

Rainer M Krug Rainer at krugs.de
Mon Oct 7 16:29:49 CEST 2013


Hi

First, sorry if I get the terminology wrong, I am still quite new to the
concept of using environments and workspaces.

Say I have a statement in a package SIM like

sim <- TYPE

where the variable TYPE is initialized in the package to
e.g. "exponential" (SIM::TYPE == "exponential").

Now, I want to give the user the option of specifying the variable TYPE,
but to the effect, that if the user does not define a variable TYPE in
the user workspace (.GobalEnv), the one in the namespace from the
package is used.

In other words, I want to look first in the workspace, and then in SIM::
for the variable TYPE. How can do this?

Thanks,

Rainer

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20131007/97e26fd7/attachment.bin>


More information about the R-devel mailing list