Hello R-help,
I keep noticing R functions that don't compare integers like
if(x == 2)
but instead
if(x == 2L)
Is this a long integer? Also, when do the two notations have a different
effect on the code?
Thanks in advance,
Alex
__
Hello,
2 is a double, 2L is an integer. Try
class(2)
[1] numeric
class(2L)
[1] integer
Hope this helps,
Rui Barradas
Em 15-05-2014 11:54, Alexander Engelhardt escreveu:
Hello R-help,
I keep noticing R functions that don't compare integers like
if(x == 2)
but instead
if(x == 2L)
Hi Alex,
May be this link helps:
http://stackoverflow.com/questions/7014387/whats-the-difference-between-1l-and-1
A.K.
On Thursday, May 15, 2014 6:55 AM, Alexander Engelhardt
a...@chaotic-neutral.de wrote:
Hello R-help,
I keep noticing R functions that don't compare integers like
if(x
Hello,
Probably you will get more complete answer, but you can compare
class(1) with class(1L).
Regards,
Pascal
On Thu, May 15, 2014 at 7:54 PM, Alexander Engelhardt
a...@chaotic-neutral.de wrote:
Hello R-help,
I keep noticing R functions that don't compare integers like
if(x == 2)
but
On 15/05/2014 11:54, Alexander Engelhardt wrote:
Hello R-help,
I keep noticing R functions that don't compare integers like
if(x == 2)
but instead
if(x == 2L)
Is this a long integer? Also, when do the two notations have a different
effect on the code?
2L is an integer. both in the
So in essence, it always provides the same output, but saves space and
speed.
Thanks everyone!
- Alex
On 05/15/2014 01:06 PM, Prof Brian Ripley wrote:
On 15/05/2014 11:54, Alexander Engelhardt wrote:
Hello R-help,
I keep noticing R functions that don't compare integers like
if(x == 2)
6 matches
Mail list logo