On Jul 3, 2013, at 4:54 PM, Erin Hodgess wrote:

> Dear R People:
> 
> 
> I am experimenting with S4 classes and methods but am having trouble with
> setting up a class.
> 
> Here is an example:
> 
>> buzz <- setClass("buzz",slots=c(x="matrix"),
> + validity <- function(object) {
> + if(is.matrix(object)==FALSE)stop("Input must be a matrix")
> + TRUE
> + })
> Error in setClass("buzz", slots = c(x = "matrix"), validity <-
> function(object) { :
>  Argument "representation" cannot be used if argument "slots" is supplied
>> 
> 
> I know that there is something simple that I'm just not seeing.

If you take the validity argument out it doesnot throw an error and the help 
page for setClass refers you to ?validObject for details.

> 
> This is R-3.0.1 for Windows.
> Thanks for any help.
> 
> Sincerely,
> Erin
> 

David Winsemius
Alameda, CA, USA

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to