[R-SIG-Finance] time index in high frequency data

2012-12-03 Thread Wei-han Liu
Hi R users:

I have a high frequency dataset with the following two time indexes: TDATE and 
TTIME. I would like to read in the following series in the specific data 
format: -mm-dd and hh-mm, and convert them as xts objects. Could any people 
can share some advice in this regard?

Many thanks.

Wei-han

TDATE TTIME 
20091009 930 
20091009 1130 
20091009 1500 
20091012 930 
20091012 1130 
20091012 1500 
20091013 930 
20091013 1130 
20091013 1500 
20091014 930 
20091014 1130 
20091014 1500 
20091015 930 
20091015 1130 
20091015 1500 
20091016 930 
20091016 1130 
20091016 1500 
20091019 930 
20091019 1130 
20091019 1500 
20091020 930 
20091020 1130 
20091020 1500 
20091021 930 
20091021 1130 
[[alternative HTML version deleted]]

___
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should 
go.


Re: [R-SIG-Finance] time index in high frequency data

2012-12-03 Thread Santosh Srinivas
You could find more direction on the r-help list .. I remember using
help from that list

You can do something like this.  (Code pasted from my routine)

f2 - function(d, t, format = %Y%m%d %H:%M:%S) {
as.POSIXct(strptime(paste(d, t),format=format))
}

require(zoo)
optData.z - read.zoo(optData.df.1[c(1:2,5:11)],index=list(1,2), FUN=f2)

The index columns refer to the date and time in your dataset.

zoo objects can be converted to xts using as.xts

I think you should be able to create xts directly using a similar approach


On Mon, Dec 3, 2012 at 5:10 PM, Wei-han Liu weihanliu2...@yahoo.com wrote:
 Hi R users:

 I have a high frequency dataset with the following two time indexes: TDATE 
 and TTIME. I would like to read in the following series in the specific data 
 format: -mm-dd and hh-mm, and convert them as xts objects. Could any 
 people can share some advice in this regard?

 Many thanks.

 Wei-han

 TDATE TTIME
 20091009 930
 20091009 1130
 20091009 1500
 20091012 930
 20091012 1130
 20091012 1500
 20091013 930
 20091013 1130
 20091013 1500
 20091014 930
 20091014 1130
 20091014 1500
 20091015 930
 20091015 1130
 20091015 1500
 20091016 930
 20091016 1130
 20091016 1500
 20091019 930
 20091019 1130
 20091019 1500
 20091020 930
 20091020 1130
 20091020 1500
 20091021 930
 20091021 1130
 [[alternative HTML version deleted]]

 ___
 R-SIG-Finance@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-sig-finance
 -- Subscriber-posting only. If you want to post, subscribe first.
 -- Also note that this is not the r-help list where general R questions 
 should go.

___
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should 
go.