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

Robin Hankin r.hankin at noc.soton.ac.uk
Fri Nov 9 12:25:30 CET 2007


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?


--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743



More information about the R-help mailing list