1

I have a dataset that contains loads of tweet-IDs and user-IDs from Twitter. When loading the dataframe in R it projects the numbers e.g. like this "1.236967e+18". Since it is not a number but an ID i need the complete numbers in order to download the tweet texts from the IDs. I tried this:

daytwo <- read.table(file = 'ids_2020-03-09.csv', sep = ';', header = TRUE, as.is = !stringsAsFactors)

However I get the error that it cannot find stringsAsFactors. I assumed that that argument was the key to project the complete numbers

Error in read.table(file = "ids_2020-03-09.csv", sep = ";", header = TRUE,  : 
  Object 'stringsAsFactors' not found

If I dont add the stringsAsFactors argument it imports the data with the +18 projection. How can I change that for the whole dataset at once? I already tried to make changes in Excel but R always changes it back when importing. Thanks!

Nicola
  • 33
  • 2
  • I guess this is simply a printing issue - check out https://stackoverflow.com/q/5352099/7941188 – tjebo Jan 04 '21 at 10:50
  • I am not sure this is just a matter of printing/display options. Nicole, could you check what data type the ID columns have? Are they loaded as double or integer? – Jan Jan 04 '21 at 10:52
  • 1
    read.table has "colClasses" argument, read ID columns as character. – zx8754 Jan 04 '21 at 10:55

1 Answers1

2

It is probably due to the fact that your ID names are viewed as numeric values in R. Have you tried converting them to a character or factor? Something like this may help:

daytwo$tweetID = as.factor(daytwo$tweetID)

bird
  • 2,938
  • 1
  • 6
  • 27