[R] "1L" and "0L"

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu May 28 10:59:46 CEST 2009


On Thu, 2009-05-28 at 12:50 +0530, bogaso.christofer wrote:
> Hi, 
> 
> Recently I come through those R-expressions and understood that "1L" means
> "1" and "0L" means "0". Why they are so? I mean, what the excess meanings
> they carry, instead writing simple "1" or "0"? Is there any more this kind
> of expressions in R?
> 

> typeof(1)
[1] "double"
> typeof(1L)
[1] "integer"

So the L notation ensures that the number is stored as an integer not a
double.

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list