SV: [R] Documentation on how to put classes and methods in packageswith namespace?
Jens Henrik Badsberg
JensHenrik.Badsberg at agrsci.dk
Tue Mar 16 14:21:29 CET 2004
Re. the Kings Quest game called R,
Inspired by the "stats4" of R-1.9.0 (alpha of 2004-03-15)
I moved the body af my function ".onLoad.dynamicGraph"
to the end of ".../dynamicGraph/R/dynamicGraph"
(replacing "library(methods)" by "require(methods)").
The secound run, with [Previously saved workspace restored],
produces the same result as in my first letter of today:
Loading required package: tcltk
> b <- DynamicGraph(1:10)
Error in getClass(superClass) : "NodeProto" is not a defined class
I also (again) read pages 13 and 16-17 (and 73) of
"Writing R Extensions" of 2004-03-15,
and the manual pages of "setClass":
where: For 'setClass' and 'removeClass', the environment in which to
store or remove the definition. Defaults to the top-level
environment of the calling function (the global environment
for ordinary computations, but the environment or namespace
of a package when loading that package).
For other functions, 'where' defines where to do the search
for the class definition, and the default is to search from
the top-level environment or namespace of the caller to this
where: the database in which to store the definition of the method;
where: The environment, namespace, or search-list position from
which to search for objects. By default, start at the
top-level environment of the calling function, typically the
global environment (i.e., use the search list), or the
namespace of a package from which the call came. It is
important to supply this argument when calling any of these
functions indirectly. With package namespaces, the default
is likely to be wrong in such calls.
It does not help me. Maybe this should be move to "a bug report".
Fra: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sendt: 16. marts 2004 12:37
Til: Jens Henrik Badsberg
Cc: r-help at stat.math.ethz.ch
Emne: Re: [R] Documentation on how to put classes and methods in
See `Writing R Extensions' in 1.9.0 alpha and the stats4 package there as
an example. At this point you probably only want to check a package
against 1.9.0 alpha, anyway.
On Tue, 16 Mar 2004, Jens Henrik Badsberg wrote:
> Documentation on how to put classes and methods in packages with namespace?
> How should I define my classes and methods in "dynamicGraph"???
> (That is - Can some one point me to the documentation on
> how to put classes and methods in packages with a namespace? )
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
More information about the R-help