Re: [Rd] Out of bounds negative index

2008-05-02 Thread Vincent Goulet
Le ven. 02 mai à 15:46, Duncan Murdoch a écrit : On 5/2/2008 3:23 PM, Vincent Goulet wrote: Hi, From the R Language Definition, Section 3.4.1: "If i is positive and exceeds length(x) then the corresponding selection is NA. A negative out of bounds value for i causes an error." (This is al

Re: [Rd] Out of bounds negative index

2008-05-02 Thread Duncan Murdoch
On 5/2/2008 3:29 PM, hadley wickham wrote: On Fri, May 2, 2008 at 2:23 PM, Vincent Goulet <[EMAIL PROTECTED]> wrote: Hi, From the R Language Definition, Section 3.4.1: "If i is positive and exceeds length(x) then the corresponding selection is NA. A negative out of bounds value for i causes

Re: [Rd] Out of bounds negative index

2008-05-02 Thread Duncan Murdoch
On 5/2/2008 3:23 PM, Vincent Goulet wrote: Hi, From the R Language Definition, Section 3.4.1: "If i is positive and exceeds length(x) then the corresponding selection is NA. A negative out of bounds value for i causes an error." (This is also mentioned in S Programming, footnote of page 24

Re: [Rd] Out of bounds negative index

2008-05-02 Thread hadley wickham
On Fri, May 2, 2008 at 2:23 PM, Vincent Goulet <[EMAIL PROTECTED]> wrote: > Hi, > > From the R Language Definition, Section 3.4.1: > > "If i is positive and exceeds length(x) then the corresponding selection is > NA. A negative out of bounds value for i causes an error." > > (This is also mentio

[Rd] Out of bounds negative index

2008-05-02 Thread Vincent Goulet
Hi, From the R Language Definition, Section 3.4.1: "If i is positive and exceeds length(x) then the corresponding selection is NA. A negative out of bounds value for i causes an error." (This is also mentioned in S Programming, footnote of page 24.) Can someone please provide an example tri

Re: [Rd] S4: what to put in initialize, validity and constructor?

2008-05-02 Thread cgenolin
Do not change initialize! As I sat, this is a toy example. In my real example, initialize does a lot of things like calculation of quality indice (b is not the scare of a, but B1, B2 and B3 are the the within matrix of A after imputation with 3 differents methods), giving names to some matr

Re: [Rd] S4: what to put in initialize, validity and constructor?

2008-05-02 Thread Sklyar, Oleg (MI London)
setClass("A", representation(a="numeric",b="numeric"), validity = function(object) { if (length([EMAIL PROTECTED])!=length([EMAIL PROTECTED])) return("different lengths of a and b") if (length([EMAIL PROTECTED])==0) return("object length is zero") TRUE } ) Do not chan

[Rd] S4: what to put in initialize, validity and constructor?

2008-05-02 Thread cgenolin
Hi the list, I have some trouble using validity, intialize and the constructor. More precisely, what should go where? Here is a toy exemple (seams long, but the code is very simple): I want to define an object with two slots a and b with the properties that b will be either empty or the scare