I am currently analyzing a chunk of around 40k tweets using R. Therefore, I am converting text to dates using as.POSIXct()
. While this works for almost all rows, I have two rows in the set which result in NA
being returned.
I already narrowed it down to a one-hour-timespan on a specific date (see below). Also changing anything else (year, month, etc.) works as well.
dateFormat <- "%Y-%m-%d %H:%M:%S"
working1 <- as.POSIXct("2014-03-30 01:59:59", format = dateFormat)
### everything in between does not work
working2 <- as.POSIXct("2014-03-30 03:00:00", format = dateFormat)
### These were the original dates:
notWorking1 <- as.POSIXct("2014-03-30 02:39:21", format = dateFormat)
notWorking2 <- as.POSIXct("2014-03-30 02:33:28", format = dateFormat)
I am not sure if I found a bug or this is my fault since I am still learning R.
As pointed out by Ronak in the comments, this was a DST issue.
It works for me but I am guessing from
I already narrowed it down to a one-hour-timespan on a specific date
if it is related to Daylight saving in your time zone ?