[Rd] Re: setClass question

John Chambers jmc at research.bell-labs.com
Mon Aug 25 18:49:51 MEST 2003

Seems that methods are being attributed a bit strangely in undoc(). 
Here's what I get with, I think, current r-devel and SparseM.

R> library(tools)
R> undoc("methods")
R> library(SparseM)
[1] "SparseM library loaded"
R> undoc("SparseM")
Undocumented code objects:
  %x% as.matrix diag diag<- diff t
Undocumented S4 methods:
  \S4method{initialize}{traceable} \S4method{initialize}{signature}
R> undoc("methods")
Undocumented S4 methods:
  \S4method{initialize}{matrix.csr} \S4method{initialize}{matrix.coo}
Warning message: 
package:methods is required by package:SparseM (still attached) in:
detach(pos = pos) 

Notice that methods for initialize() seem to be cross-attributed to
"methods" and "SparseM".  (And despite the message, there IS
documentation for both  method?initialize("traceable") and
method?initialize("matrix.csr"), but of course in the other package.)

If it's relevant, after the undoc("methods"), the order of the search
list has been altered, with methods in position 2 (maybe related to the
warning message when it was detached from its previous position?).

The "Undocumented code objects" messages are "real", but not your
fault--we'll have to figure what to do about them.  You created methods
for "diag" (I assume), which is a non-generic in base.  The result is to
create a generic version of diag(), which is assigned in your package. 
(In general, with namespaces, I don't think it's possible to assign the
generic back into the original package, even just into the exported

R> find("diag")
[1] "package:SparseM" "package:base"   

This creates a formal "conflict" but in my understanding not one that
should be reported, nor should you be expected to document the function
diag(), as opposed to methods created for it.

[Just got back to e-mail after 3 days away.  Will look at this and your
other mail, probably not until tomorrow.]


Roger Koenker wrote:
> I have another S4 methods query -- this time about undocumented objects:
> I'm now getting the following warning from R CMD check SparseM:
> * checking for missing documentation entries ... WARNING
> Undocumented code objects:
>   %x% as.matrix diag diag<- diff t
> Undocumented S4 methods:
>   \S4method{coerce}{ANY,array} \S4method{coerce}{ANY,call}
>   \S4method{coerce}{ANY,character} \S4method{coerce}{ANY,complex}
>   \S4method{coerce}{ANY,environment} \S4method{coerce}{ANY,expression}
>   \S4method{coerce}{ANY,function} \S4method{coerce}{ANY,integer}
>   \S4method{coerce}{ANY,list} \S4method{coerce}{ANY,logical}
>   \S4method{coerce}{ANY,matrix} \S4method{coerce}{ANY,name}
>   \S4method{coerce}{ANY,numeric} \S4method{coerce}{ANY,single}
>   \S4method{coerce}{ANY,ts} \S4method{coerce}{ANY,vector}
>   \S4method{coerce}{ANY,NULL}
>   \S4method{coerce}{vector,matrix.diag.csr}
>   \S4method{diff}{matrix.csr} \S4method{initialize}{traceable}
>   \S4method{initialize}{signature} \S4method{initialize}{environment}
> A couple of these are directly related to the package, but the rest
> seem to be items that I wouldn't have thought that I should be responsible
> for documenting.  I'm wondering whether the coerce items are related to
> my earlier query.  Even supposing that they were due to some blunder
> of mine, I'm still puzzled by the initialize items which were present
> even before I began to mess with my new setClass strategy.  Again,
> many thanks for any suggestions.
> url:    www.econ.uiuc.edu/~roger/my.html        Roger Koenker
> email   rkoenker at uiuc.edu                       Department of Economics
> vox:    217-333-4558                            University of Illinois
> fax:    217-244-6678                            Champaign, IL 61820
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

John M. Chambers                  jmc at bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc

More information about the R-devel mailing list