Re: [R] difftime on vector

2011-09-15 Thread jim holtman
You need to supply two vectors: > x <- seq(Sys.time(), by = '10 min', length = 10) > x [1] "2011-09-15 09:58:30 EDT" "2011-09-15 10:08:30 EDT" "2011-09-15 10:18:30 EDT" [4] "2011-09-15 10:28:30 EDT" "2011-09-15 10:38:30 EDT" "2011-09-15 10:48:30 EDT" [7] "2011-09-15 10:58:30 EDT" "2011-09-15 11

[R] difftime on vector

2011-09-15 Thread bradford
How can I apply difftime to a vector of sorted dates? I can do this just fine with diff, but difftime doesn't seem to take in a vector. > diff(r$BOOKING_DATE) Works. Great! > difftime(r$MY_DATE, units="days") Error in as.POSIXct(time2) : argument "time2" is missing, with no default Thanks, Bra