I've started using R programming language and I learnt about Numeric and Integer variables. I did understand that x <- 3.5
returns numeric and that x <- 3L
returns integer, but what does the L stand for? And are there other ways to declare whole numbers? (For example in Java there's the possibility to use long, int or BigInteger)
Asked
Active
Viewed 46 times
0
-
What kinds of "other ways" to cast are you looking for. R tends to keep numbers in a more general "numeric" vector. – MrFlick Sep 22 '17 at 14:09
-
You should ask one question per post. Your second question "cast as variables" is unclear, so I went with the first "why L?". – Frank Sep 22 '17 at 14:15
-
The duplicates half answered my problem, but I'm still looking for something like a method or other variables to declare whole numbers (if they exist of course, also methods that can easily convert from Numeric to Integers would be okay) – Sep 22 '17 at 14:16
-
2Type declarations are not a core feature of R; though the vetr package is good for asserting/testing types. As I said, the link half answered your question because you shoehorned two questions into one. A goal of this site is to create a Q&A repository, but it is harder to find and link similar questions if askers insist on tossing together multiple questions into one. Also, of course, you run the risk of "partial" answers if you insist on this approach. – Frank Sep 22 '17 at 14:24
-
1Thank you for your answer, I didn't consider that when asking my question and when you pointed it out, it was too late and I preferred to leave the question in the eventuality of someone else looking for my same things – Sep 22 '17 at 14:28