[R-SIG-Finance] xts metadata

Brian G. Peterson brian at braverock.com
Sat Apr 23 23:36:06 CEST 2011


Peter,

We stored information like the data source with the instrument metadata
in FinancialInstrument, since we also used that to control our calls to
getSymbols, we could always look up info in the instrument metadata with
getInstrument.

Regards,

  - Brian

On Sat, 2011-04-23 at 16:28 -0500, Jeff Ryan wrote:
> Hi Pete,
> 
> I short, zoo and xts don't support column based attributes, though it has been discussed at least a few times that I am aware of. 
> 
> My advice would be to "overload" the colnames with some sort of internally designed naming convention - much as quantmod does with AAPL.Open etc.
> 
> In terms of potential for col attributes to be built-in -- it is possible, but not probable at this point is my guess. Given that the above naming scheme will work, it hasn't caused too much trouble in the past, and getting it to be consistent/logical across all of the ops and expectations, I would sooner leave it alone to concentrate on more pressing needs. 
> 
> HTH
> Jeff
> 
> 
> 
> On Apr 23, 2011, at 2:15 PM, Pete Brecknock <Peter.Brecknock at bp.com> wrote:
> 
> > I would like to attach metadata to an xts series that will hold the name of
> > the data source system of that series. When this series is subsequently
> > merged with other xts data objects I would be able to recover this name and
> > identify its original source system.
> > 
> > My effort below is not returning what I expect. 
> > 
> > # Generate Data
> > x1 = xts(1:10,Sys.Date()+1:10)
> > x2 = xts(11:20,Sys.Date()+1:10)
> > x3 = xts(21:30,Sys.Date()+1:10)
> > x4 = xts(31:40,Sys.Date()+1:10)
> > x5 = xts(41:50,Sys.Date()+1:10)
> > 
> > # Simulate Data from Two Different Sources
> > x12  = merge(x1,x2)   # Data from Data System A
> > x345 = merge(x3,x4,x5)  # Data from Data System B
> > 
> > # Set metadata
> > attr(x12,"source") = "A"
> > attr(x345,"source") = "B"
> > 
> > # All Systems Data
> > x12345 = merge(x12,x345)
> > 
> > # Query Sources
> > attr(x12345,"source")      # returns "A"
> > attr(x12345[,1],"source") # returns "A" 
> > attr(x12345[,5],"source") # returns "A" expecting "B"
> > 
> > I would gratefully receive any suggestions.
> > 
> > Thanks and kind regards
> > 
> > Pete
> > 
> > --
> > View this message in context: http://r.789695.n4.nabble.com/xts-metadata-tp3470514p3470514.html
> > Sent from the Rmetrics mailing list archive at Nabble.com.
> > 
> > _______________________________________________
> > R-SIG-Finance at 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 at 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.

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list