Format Tweet_id and status_id: "e" in Tweet_id and/or status_id

207 views Asked by At

I crawled some Tweets with R using the Twitter API. Now I am looking at the data and some of the Tweets have either a Tweet_id or user_id looking like this 5.03453238356772e-223. This doesn't allow me to look for the respective screen_name. Anyone who knows how I could look up the screen name with a user oder tweet_id looking like this? Is it possible to convert it, to a more 'normal' format, like 49616273?

2

There are 2 answers

0
Mickaël Martinez On

From the Twitter API documentation:

Twitter IDs are unique 64-bit unsigned integers [...] Numbers as large as 64-bits can cause issues with programming languages that represent integers with fewer than 64-bits.

And as far as I know, it can be the case with R.

So if you are using the V1.1 API, use the id_str field instead of the id field, and if you are using the V2 API (or were already using the id_str field), store it as a string and do not cast it to int.

0
Andy Piper On

I expect that what has happened here is that something (maybe a spreadsheet program?) is mangling the Tweet and User IDs. These are 64-bit large integers. The Twitter API returns these values as strings, to avoid anything reformatting them. You'll need to go back and get the data again, and save the values in a format where the number is not converted to another format.