An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090528/ef9f2238/attachment-0001.pl>
"1L" and "0L"
3 messages · Christofer Bogaso, Gavin Simpson, Duncan Murdoch
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 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
On 28/05/2009 3:20 AM, 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?
Gavin explained the L marks the number as being stored as an integer. The i in 1i is somewhat similar: it marks the number as complex (but also changes the value, 1i is the imaginary value, not the real one). There's a discussion on this in section 3.1.1 "Constants" in the R Language Definition. Duncan Murdoch