Working with Twitter Timestamps in R
R
Twitter
Reading Twitter time and date strings in R
Tweets returned by Twitter’s API contain a timestamp field called “created_at” that cannot be directly read by R. For example, using the default behavior of as.POSIXct(timestamp)
produces incorrect internal date representations. Thankfully, formatting the timestamp is simple:
## Assuming your timestamps are located in the variable "timestamps":
<- "%a %b %d %H:%M:%S %z %Y"
date_format <- as.POSIXct(strptime(timestamps, date_format, tz = "EST"), tz = "EST") timestamps