On 24 Feb 2004 at 21:38, Uwe Ligges wrote:

> > setClass("myclass", representation("ANY", x = "numeric", y
> > ="numeric"))
> > 
> > new("myclass", 1:10)            # works
> > new("myclass", "Test")          # works
> > new("myclass", factor(1:10))    # fails
>
> Why do you think it fails?

I was typing faster than thinking. It doesn't actually fail but what I get is 
a numeric vector with a levels attribute. If I specify a factor as .Data 
part I expect that the created object IS a factor and 
is.factor(new("myclass", factor(1:10))) returns TRUE.
 
> It works perfectly for me with R-1.8.1 for Windows.
> You haven't told anything about your R version, I suspect your are
> using an outdated one.

Sorry, forgot that one. I'm also using R 1.8.1 on Windows.

Thanks,

Torsten

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to