[Rd] slot named C

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Apr 17 15:56:59 CEST 2006


It's an error in your usage  The args of new() are

> args(new)
function (Class, ...)

and what does 'C' match?  You need to name your arguments here.

On Mon, 17 Apr 2006, Paul Gilbert wrote:

> "C" appears to be an illegal name for a slot in an S4 class (example
> below).

It is rather an example of something which does not work.

foo <- new("testobj")
foo at C <- 2

does, for example.

> If this is a known limitation, and not a bug, it would be nice
> if it were caught by setClass.
>
> Paul Gilbert
>
> > setClass("testobj", representation ( C = "numeric"))
> [1] "testobj"
> > new("testobj", C= 2)
> Error in methodsPackageMetaName("C", name) :
>        'The name of the object (e.g,. a class or generic function) to
> find in the meta-data' must be a single string (got an object of class
> "numeric")
>
> > setClass("testobj", representation ( C. = "numeric"))
> [1] "testobj"
> > new("testobj", C.= 2)
> An object of class "testobj"
> Slot "C.":
> [1] 2
> ====================================================================================
>
> La version française suit le texte anglais.
>
> ------------------------------------------------------------------------------------
>
> This email may contain privileged and/or confidential inform...{{dropped}}
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
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-devel mailing list