ok, thanks. Now I'll tell you what I am working on. I wish to enhance Chart_Series and add_Series to add annotations to charts. For example, I, say I have identified 20 days which have candlestick gaps, and I wish to annotate the underlying candlestick chart. I would like to pass this array of dates to chart_Series and place a symbol next to each of the 20 associated candles. The difficulty is that the text() function takes as its first argument the integer index (the row number of the xts structure). <div>
<br></div><div>In any case, regardless of whether I am expressing myself correctly or not, I do understand the differences between xts and data.frame, and I still believe that there must be a way to go from date to row number when dealing with xts objects. In the meantime, I'll implement the inefficient solution. </div>
<div><br></div><div>I am quite surprised that chart_Series (which is quite powerful, thanks) does not have a built in annotation functionality. </div><div><br></div><div>I attach two images. One that I have created, and one, close to what I would like to create. The image with the "G" is what I have done by changing chart_Series. </div>
<div><br></div><div>Thanks for all your help and comments. </div><div><br></div><div> </div><div> Gordon<br><div><br></div><div><br><br><div class="gmail_quote">On Mon, Apr 30, 2012 at 4:26 PM, Brian G. Peterson <span dir="ltr"><<a href="mailto:brian@braverock.com" target="_blank">brian@braverock.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, 2012-04-30 at 16:15 -0400, Gordon Erlebacher wrote:<br>
> I would have assumed the existence of a function in R to accomplish<br>
</div>> this.After all, a data frame is a list of columns, each column is a<br>
> vector,which is indexed. We are not dealing with hash tables.<br>
<br>
As Josh already told you, and xts object and a data.frame have *nothing*<br>
to do with each other.<br>
<br>
Your example first creates a data.frame of row numbers, which could be<br>
easily found via which()<br>
<br>
Part of the difficult here is that *usually* if you are referring to row<br>
numbers in an xts object, you're doing it wrong. For time series data,<br>
refer to the timestamp (the actual index), not to a row number. You can<br>
reference row numbers in xts, you just usually shouldn't.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Brian<br>
<br>
</font></span></blockquote></div><br></div></div>