a <- c("12/4/2010 9:30:00","12/4/2010 9:31:00","12/4/2010 9:32:00",
"12/4/2010 9:33:00","12/4/2010 9:34:00","12/4/2010 9:35:00")
b <- strptime(a,"%d/%m/%Y %H:%M:%S")
> time(a)
[1] 1 2 3 4 5 6
attr(,"tsp")
[1] 1 6 1
> time(b)
Error in hasTsp(x) : invalid time series parameters specified
> timeBased(a)
[1] FALSE
> timeBased(b)
[1] TRUE
有没有办法让它同时适用于time
和timeBased
函数,这意味着使用time
和返回TRUE
时没有错误timeBased
?