First thing to notice in your second example is that you have "factor" for
what you think are strings. You should try:
u2<-as.difftime(c(as.character(a),as.character(b)), format ="%Y-%m-%d
%H:%M:%S", units="mins")
and see if this gives you what you are expecting. If you are reading this
in with
I'm new to R and have the following problem with difftime:
if I directly assign date/time strings in difftime I get the expected
result:
> a<-"2010-03-23 10:52:00"
> a
[1] "2010-03-23 10:52:00"
> b<-"2010-03-23 11:53:00"
> u2<-as.difftime(c(a,b), format ="%Y-%m-%d %H:%M:%S", units="mins")
> u2
T
2 matches
Mail list logo