datetime - format time using as.POSIX in R -


i want put time month-date-year hour-min time series data called test. want specify starting time 2014-01-01 00:00:00. code returns error , tried several times still cannot fix it.

> t<-c("2014-01-01 00:00:00")  > solar_inp<-xts(test, seq(from=as.posixct(test,origin=t),                            length.out=8760,by=as.difftime(1,units='hours'))) 

the error says " 'from' must of length 1".

thank much!

"01-01-2014 00:00:00" not in 1 of standard formats, (at least) need add ..., format="%m-%d-%y %h:%m:%s" as.posixct call. untested since did not include "test" object.

@senor o has point. better set t="2014-01-01 00:00:00" ... things "just work". if index in test object flawed need fix it, too.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -