I really just want to do something like
x <- as.integer(c(1,2,3))
But because c(1,2,3) is stored as a floating point vector I’m worried that I’ll have problems with truncation, such as
> as.integer(1.99999999999)
[1] 1
How do I know I’m safe?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you can use a suffix
L:Or if you already have a numeric vector and convert it into integer, you can explicitly describe the rule: