[R-SIG-Finance] date to index

Brian G. Peterson brian at braverock.com
Mon Apr 30 22:26:03 CEST 2012


On Mon, 2012-04-30 at 16:15 -0400, Gordon Erlebacher wrote:
> I would have assumed the existence of a function in R to accomplish
> this.After all, a data frame is a list of columns, each column is a
> vector,which is indexed. We are not dealing with hash tables. 

As Josh already told you, and xts object and a data.frame have *nothing*
to do with each other.

Your example first creates a data.frame of row numbers, which could be
easily found via which()

Part of the difficult here is that *usually* if you are referring to row
numbers in an xts object, you're doing it wrong.  For time series data,
refer to the timestamp (the actual index), not to a row number.  You can
reference row numbers in xts, you just usually shouldn't.

  
-- 
Brian



More information about the R-SIG-Finance mailing list