d$Accessed.Time<-strptime(d$accessed_at,format="%Y-%m-%d %H:%M:%S")
d$Counselor.Added.Time<-strptime(d$counselor_added_at,format="%Y-%m-%d %H:%M:%S")
d$logtime<-as.numeric(d$Accessed.Time-d$Counselor.Added.Time,units="days")
View(d[which(is.na(d$logtime)),
c("accessed_at","Accessed.Time","counselor_added_at","Counselor.Added.Time","logtime")])
First I converted d$accessed_at
and d$counselor_added_at
to R Datetime variable and performed an arithmetic operation on it and stored it in d$logtime
. The weirdest thing is that R will treat certain d$Counselor.Added.Time
as NA
even though they are converted successfully.
The above screenshot is of that last View
statement in R
is.na()
will return TRUE
for Counselor.Added.Time
for all these observations and then having arithmetic operation fail on them even though they appear to be converted successfully.
Does anyone know what's going on?
it appears that this error is specific to these specific times
I tried this:
a<-strptime("2015-03-08 02:33:07",format="%Y-%m-%d %H:%M:%S")
and
is.na(a)
returned TRUE