Re: [R] rowSums() and is.integer()

2007-11-21 Thread Prof Brian Ripley
On Tue, 20 Nov 2007, Tim Hesterberg wrote: I wrote the original rowSums (in S-PLUS). There, rowSums() does not coerce integer to double. Actaully, neither does R. It computes a double answer but does no coercion per se. However, one advantage of coercion is to avoid integer overflow.

Re: [R] rowSums() and is.integer()

2007-11-21 Thread Robin Hankin
On 21 Nov 2007, at 08:30, Prof Brian Ripley wrote: On Tue, 20 Nov 2007, Tim Hesterberg wrote: I wrote the original rowSums (in S-PLUS). There, rowSums() does not coerce integer to double. Actaully, neither does R. It computes a double answer but does no coercion per se. However, one

Re: [R] rowSums() and is.integer()

2007-11-21 Thread Prof Brian Ripley
On Wed, 21 Nov 2007, Robin Hankin wrote: On 21 Nov 2007, at 08:30, Prof Brian Ripley wrote: On Tue, 20 Nov 2007, Tim Hesterberg wrote: I wrote the original rowSums (in S-PLUS). There, rowSums() does not coerce integer to double. Actaully, neither does R. It computes a double answer

Re: [R] rowSums() and is.integer()

2007-11-20 Thread Tim Hesterberg
I wrote the original rowSums (in S-PLUS). There, rowSums() does not coerce integer to double. However, one advantage of coercion is to avoid integer overflow. Tim Hesterberg ... So, why does rowSums() coerce to double (behaviour that is undesirable for me)?

[R] rowSums() and is.integer()

2007-11-09 Thread Robin Hankin
Hi [R-2.6.0, macOSX 10.4.10]. The helppage says that rowSums() and colSums() are equivalent to 'apply' with 'FUN = sum'. But I came across this: a - matrix(1:30,5,6) is.integer(apply(a,1,sum)) [1] TRUE is.integer(rowSums(a)) [1] FALSE so rowSums() returns a float. Why is this? --