Don't use "long format". That is, run the symbols across columns - one symbol per column i.e. "wide format".
Since xts is a matrix, you'll nee to make sure to keep the coredata numeric - mixing symbols into columns assures it isn't. >From there you can either plot with plot.xts and lines or plot.zoo. Best, Jeff Jeffrey Ryan | Founder | [email protected] www.lemnica.com On Jan 22, 2011, at 1:01 PM, Nick Torenvliet <[email protected]> wrote: > Hi all, > > I may have double posted this, so apologies, for some reason R-help doesn't > seem to be posting for me. > > I've got an xts time series of stock symbols and closing prices. > >> head(x) > symbol close > 2010-01-04 "AFB" "13.46" > 2010-01-04 "AKP" "12.80" > 2010-01-04 "APX" " 8.78" > 2010-01-04 "AYN" "13.15" > 2010-01-04 "BAF" "13.50" > 2010-01-04 "BBF" "12.86" >> tail(x) > symbol close > 2011-01-21 "VMO" "12.35" > 2011-01-21 "VOQ" "13.77" > 2011-01-21 "VPV" "11.97" > 2011-01-21 "VTJ" "14.74" > 2011-01-21 "VTN" "13.16" > 2011-01-21 "XAA" "12.82" > >> is.xts(x) > [1] TRUE > > I've made the symbols a factor > >> head(xFactor) > symbol <NA> <NA> <NA> <NA> <NA> > AFB AKP APX AYN BAF BBF > 154 Levels: AFB AKP APX AYN BAF BBF BBK BFK BFO BFZ BIE BJZ BKK BKN BLH ... > XAA > > Each factor represent a time series on closing prices. > > I would like to plot those 154 time series on a single plot... > > Any ideas? > > Regards, > > Nick > > [[alternative HTML version deleted]] > > _______________________________________________ > [email protected] 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. _______________________________________________ [email protected] 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.
