Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9209661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:53:49+00:00 2026-06-18T00:53:49+00:00

I was using a function that requires input as integers. So I have been

  • 0

I was using a function that requires input as integers.

So I have been trying to read up on making things integers:

y <- 3.14
as.integer(y)
[1] 3              # all cool

All good, but if I have

 x <- 1639195531833
 as.integer(x)
 [1] NA
 Warning message:
 NAs introduced by coercion 

I had options(digits = 15) on and it confused my why it wasn’t working but in a clean session it must be to do with the scientific notation.

I also tried to trick R but it was not happy:

  as.integer(as.character(x))
[1] 2147483647
Warning message:
inaccurate integer conversion in coercion 

How do I defeat scientific notation and get my integers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:53:50+00:00Added an answer on June 18, 2026 at 12:53 am

    The largest integer R can hold is

    .Machine$integer.max
    # [1] 2147483647
    

    This has nothing to do with scientific notation and everything to do with how the computer actually stores the numbers. The current version of R stores integers still as 32bit, regardless of the architecture. This might change in the future though.

    see also ?as.integer

    Currently you can get access to 64 bit integers through the int64 package

    > as.integer(.Machine$integer.max)
    [1] 2147483647
    > # We get problems with this
    > as.integer(.Machine$integer.max + 1)
    [1] NA
    Warning message:
    NAs introduced by coercion 
    > # But if we use int64
    > library(int64)
    > as.int64(.Machine$integer.max) + 1L
    [1] 2147483648
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ive a function that does calculations on a table using jquery when any input
I have a function that I'm using while(true) to repeatedly scan memory addresses of
I have the following function that I am using to remove the characters \04
I'm writing a function that requires an input vector of dates which I specify
I am trying to create an s-function in Simulink using s-function builder that will
I'm working on a program that requires the user to input an integer. How
I have an API function that takes constant char * as an input. I
I have a logout function that woks correctly when using chrome. But with Firefox,
I am using this function (that I found on this forum) to calculate the
Hi am using this function that works by a single ID ( 52000121 )

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.