Is there a easy way to create the time index for a zoo/xts object for every 100 milliseconds. eg. time Index would be: 10:00:00:100 10:00:00:200 10:00:00:300 10:00:00:400 I am looking to build an empty zoo/xts object with time index from 10am to 3pm, index jumps by 100ms each row. Thanks, Chris -- View this message in context: http://r.789695.n4.nabble.com/Create-a-zoo-xts-Time-Series-with-Millisecond-jumps-tp3332427p3332427.html Sent from the R help mailing list archive at Nabble.com.
Gabor Grothendieck
2011-Mar-02 23:20 UTC
[R] Create a zoo/xts Time Series with Millisecond jumps
On Wed, Mar 2, 2011 at 5:14 PM, rivercode <aquanyc at gmail.com> wrote:> Is there a easy way to create the time index for a zoo/xts object for every > 100 milliseconds. > > eg. ?time Index would be: > > 10:00:00:100 > 10:00:00:200 > 10:00:00:300 > 10:00:00:400 > > I am looking to build an empty zoo/xts object with time index from 10am to > 3pm, index jumps by 100ms each row. >Here are three ways. as.xts(z2) could be used to turn the second one into xts. library(zoo) library(chron) len <- 5 * 60 * 60 * 10 + 1 # use chron times class z1 <- zoo(, seq(times("10:00:00"), times("15:00:00"), length = len)) # use POSIXct times z2 <- zoo(, seq(as.POSIXct("2011-01-01 10:00:00"), as.POSIXct("2011-01-01 15:00:00"), length = len)) # number intervals from 1 to len z3 <- zoo(, seq_len(len)) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
Apparently Analagous Threads
- xts POSIXct index format
- XTS : merge.xts seems to have problem with character vectors
- Aggragating subsets of data in larger vector with sapply
- How to do operations on zoo/xts objects with Monthly and Daily periodicities
- Time series: xts/zoo object at annual (yearly) frequency