From hpages at fhcrc.org  Tue Dec  4 23:31:48 2012
From: hpages at fhcrc.org (=?windows-1252?Q?Herv=E9_Pag=E8s?=)
Date: Tue, 04 Dec 2012 14:31:48 -0800
Subject: [Rd] inconsistencies between ?class and ?UseMethod
Message-ID: <50BE79D4.5060205@fhcrc.org>

Hi,

The 2 man pages give inconsistent description of class():

Found in ?class:

      If the object does not have a class attribute, it has an implicit
      class, ?"matrix"?, ?"array"? or the result of ?mode(x)? (except
      that integer vectors have implicit class ?"integer"?).

Found in ?UseMethod:

      Matrices and arrays have class ?"matrix"? or?"array"? followed
      by the class of the underlying vector.
      Most vectors have class the result of ?mode(x)?, except that
      integer vectors have class ?c("integer", "numeric")? and real
      vectors have class ?c("double", "numeric")?.

So according to ?UseMethod, class(matrix(1:4)) should be
c("matrix", "integer", "numeric"), which is of course not the case:

   > class(matrix(1:4))
   [1] "matrix"

I wonder if this was ever true, and, if so, when and why it has changed.

Anyway, an update to ?UseMethod would be welcome. Or, documenting
class() in only 1 place seems even better (more DRY principle).

Thanks,
H.

-- 
Herv? Pag?s

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



[Rd] inconsistencies between ?class and ?UseMethod
=?windows-1252?Q?Herv=E9_Pag=E8s?=