[R-SIG-Finance] Time indexation after selection in an xts object
Karim
kktrash.k at gmail.com
Tue May 1 13:04:45 CEST 2012
Hi,
My xts object : SP500TiSa
> head(SP500TiSa)
BID OFR PRICE SIZE
2012-01-23 06:00:58 1306.75 1307 1307.00 2
2012-01-23 06:00:58 1306.75 1307 1306.75 6
2012-01-23 06:00:58 1306.75 1307 1307.00 1
2012-01-23 06:00:58 1306.75 1307 1307.00 2
2012-01-23 06:00:59 1306.75 1307 1307.00 1
2012-01-23 06:00:59 1306.75 1307 1307.00 1
What I want to do is to calculate the cumulated sum of the column SIZE of
the records of day 2012-01-24 but I want the resulting selection to keep the
time information
> s=cumsum(SP500TiSa$SIZE['2012-01-24'])
When I plot s, that's ok, I have the time information on the x-axis of the
graph :
> plot(s,type="l")
But when I display s on the console :
> head(s)
SIZE
2012-01-24 4
2012-01-24 5
2012-01-24 6
2012-01-24 16
2012-01-24 17
2012-01-24 32
We have only the day information on the index. The time info is lost, how to
keep it ?
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120501/85b5ff0f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 12714 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120501/85b5ff0f/attachment.jpe>
More information about the R-SIG-Finance
mailing list