[R] Why are integers coded as e.g. "2L" in R functions?

Pascal Oettli kridox at ymail.com
Thu May 15 13:05:45 CEST 2014


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
<alex at chaotic-neutral.de> 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?
>
> Thanks in advance,
>  Alex
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan



More information about the R-help mailing list