Re: [Rd] Matrices given to pt? [was: [R] for loops and counters]

2006-07-18 Thread Prof Brian Ripley
There is a general rule that scalar operations (that is functions that work element-by-element and return a scalar result) preserve attributes including names, dims and dimnames. Similarly, there is a general rule about binary operations and attributes. These things should definitely be in the

[Rd] Matrices given to pt? [was: [R] for loops and counters]

2006-07-15 Thread François Pinard
Hi, people. I was a bit intrigued by the message quoted below. Indeed, if pt() is given a matrix, it returns a matrix. Should this feature be documented? ?pt speaks about a vector of quantiles, and says nothing about the type of what it returns. The same might presumably apply to other

Re: [Rd] Matrices given to pt? [was: [R] for loops and counters]

2006-07-15 Thread Gabor Grothendieck
I think what is happening is that it is preserving attributes of the input. e.g. x - 1:3 attr(x, A) - 23 pt(x, 3) [1] 0.8044989 0.9303370 0.9711656 attr(,A) [1] 23 Note that attribute A was preserved. Since matrices are just vectors with a dim attribute that would imply the result. I agree