>>>>> "Benjamin" == Benjamin STABLER <[EMAIL PROTECTED]>
>>>>>     on Wed, 14 Jan 2004 15:52:46 -0800 writes:

          <........>

    Benjamin> So it looks like R stores numbers as doubles
    Benjamin> unless the are converted to integers (long) with
    Benjamin> the as.integer() function or they are created with
    Benjamin> the : operator.  
+/- yes;
In most cases, this should not matter though.

There are a few other functions that return integer ``by
definition'', e.g.,
length(), dim(), nrow(), ncol()  {the latter 3 return 'NULL' or an integer}.


    Benjamin> If any of the numbers to a function are not type
    Benjamin> integer than the function returns type double.  Is
    Benjamin> this the case?

Most functions will return double even when all numeric arguments are
integer.  Also, e.g. length() will return integer() in any case.

Only for some "arithmetic" functions
      (+, -, *, %%, %/%, also min(), max(), sum())
your statement is true.
But really, in most cases, code shouldn't rely on this.

Martin Maechler <[EMAIL PROTECTED]>     http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16    Leonhardstr. 27
ETH (Federal Inst. Technology)  8092 Zurich     SWITZERLAND
phone: x-41-1-632-3408          fax: ...-1228                   <><

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to