Re: [Rd] Problem with _new_ if class "lm" in object representation.

2004-09-29 Thread Witold Eryk Wolski
Hi, Thanks a lot for pointing me to setOldClass(). What is exactly the point against it, to allow NULL to be a special case which can be assigned to any slot? I think in java one can assing null to any slot (I do not like java but not because of that). I am asking because for some objects it may

Re: [Rd] Problem with _new_ if class "lm" in object representation.

2004-09-29 Thread John Chambers
Witold Eryk Wolski wrote: > > Hi, > The hint to use an lm0 instance in the protopy is a solution. > > But I thought about a different solution to which I got used. This is to > declare class "lm" as an S4 class by setClass("lm"). It's a good idea to declare S3 classes, but that's not the way to

Re: [Rd] Problem with _new_ if class "lm" in object representation.

2004-09-29 Thread Witold Eryk Wolski
Hi, The hint to use an lm0 instance in the protopy is a solution. But I thought about a different solution to which I got used. This is to declare class "lm" as an S4 class by setClass("lm"). This is because I have to do it anyway quite frequently when using S3 classes, declared in contributed

Re: [Rd] Problem with _new_ if class "lm" in object representation.

2004-09-29 Thread John Chambers
Wolski wrote: > > Hi! > Consider this code. > > setClass("Ctest" > ,representation( > test="character" > ,bla="character" > ,mod="lm" > ) > ) > > new("Ctest",test="bla") #This produces an error. >

Re: [Rd] Ordering of values returned by unique

2004-09-29 Thread Witold Eryk Wolski
Hi, If you go to the frame on www.r-project.org -> documentation -> publication and search for "blue book" "green book" you will find that this refers to two books : /"The New S Language" //"Programming with Data" respectively / Mass refers to "/Modern Applied Statistics with S"/ /E Earl F. Glynn w

Re: [Rd] Ordering of values returned by unique

2004-09-29 Thread Tony Plate
"Blue book" and "Green book" are nicknames for books that are primary references for the S language, see FAQ 3.1. "MASS 4th Ed" is W. N. Venables and B. D. Ripley (2002), "Modern Applied Statistics with S. Fourth Edition". Springer, ISBN 0-387-95457-0 At Wednesday 10:39 AM 9/29/2004, Earl F. Gl

[Rd] Problem with _new_ if class "lm" in object representation.

2004-09-29 Thread Wolski
Hi! Consider this code. setClass("Ctest" ,representation( test="character" ,bla="character" ,mod="lm" ) ) new("Ctest",test="bla") #This produces an error. #Error in validObject(.Object)

Re: [Rd] Ordering of values returned by unique

2004-09-29 Thread Earl F. Glynn
"Tony Plate" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I depend on this all the time, so I also checked some references. In the > Blue book the documentation for the functions unique and duplicated is > combined and implies the above. In MASS 4th Ed, the page referred to by >

Re: [Rd] Ordering of values returned by unique

2004-09-29 Thread Tony Plate
At Wednesday 10:09 AM 9/29/2004, I wrote: [snip] So, I think the evidence is pretty strong that unique(x) will always return elements in the same order as they first appear in x. But it would be nice if the documentation for 'unique' explicitly stated that this is the behavior for all methods.

Re: [Rd] Ordering of values returned by unique

2004-09-29 Thread Witold Eryk Wolski
Hi! Thanks for this explanation and pointing me to value section of the documention and the function duplicate. Indeed the documentation entry in the value section states: An object of the same type of 'x'. but if an element is equal to one with a smaller index, it is removed. Could have found i

Re: [Rd] Ordering of values returned by unique

2004-09-29 Thread Tony Plate
AFAIK, it has always worked that way in S-plus and R. Furthermore, the documentation in R for 'unique' says that it removes duplicated elements. This does seem to leave the possibility that element other than the first of a set of duplicates is retained, which could mess up the order. Howeve

[Rd] Ordering of values returned by unique

2004-09-29 Thread Witold Eryk Wolski
Hi, Is the ordering of the values returned something on what I can rely on, a form of a standard, that a function called unique in R (in futher versions) will return the uniq elements in order of they first occurcence. > x<-c(2,2,1,2) > unique(x) [1] 2 1 Its seems not to be the standard. E.g. m