From ripley at stats.ox.ac.uk  Fri May 25 12:56:54 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 25 May 2007 11:56:54 +0100 (BST)
Subject: [Rd] private variables in package.
In-Reply-To: <10800416.post@talk.nabble.com>
References: <10800416.post@talk.nabble.com>
Message-ID: <Pine.LNX.4.64.0705251155280.14500@gannet.stats.ox.ac.uk>

R has debugging features: see 'Writing R Extensions'.  Please make use of 
them, e.g. options(error=recover) will enable you to explore the 
environments that are visible.

We can only guess at this, not having function AB2C.

On Fri, 25 May 2007, Vladimir Eremeev wrote:

>
> I am sorry, my previous questions about hiding variables from users in a
> package were obscure and vague, and would like to clarify them.
>
> This should be a basic question.
> I am writing my first package.
> It has several functions, which should be callable by users.
> These functions use several variables, and I would like to hide these
> variables from users.
> How can I do it?
>
> For example, the package has a function AB2C, which uses the variable ac9nw.
> If I add the file NAMESPACE, exporting only AB2C, then I get the error:
>
>   Error in AB2C(a, b, model.type) : object "ac9nw" not found
>
> I also tried to include in the .onLoad function the code, defining these
> variables with <<-
> However, this code has created all internal variables in the global
> environment.
>
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] private variables in package.
Prof Brian Ripley