xts package–deliberate practice
I seem to have forgotten xts package functionality. Let me do one thing for a change today. I will remember the major functionality of xts data and then read the documentation again.
What do I recall about the package ?
- used to store time series data
- written on the top of “zoo” package
- written by Jeffery Ryan
- has a lot of nice functions like endpoints, rollapply, etc
- more than one time series can be put in an xts object
- functions I remember using from this package are endpoints, rollapply, apply,etc
Ok, now let me read a formal article on xts
- xts biggest advantage is extensibility and hence its name. Arbitrary attributes can be added or removed. If you use as.xts() your original object is stored well in the format
- subsetting functions are very useful CCYY:MM:DD/CCYY:MM:DD can be used to subset the xts object
- plotting an xts object is more richer than plain plot from base package
- first() , last() functions are also useful to check the range of xts
- index class for an xts object can be anything. indexClass() function can be used to retrieve the index class. convertIndex() can be used to convert an xts object with a certain indexClass to a desired indexClass
- You can convert a matrix in to xts object by seeing to it that matrix has rownames that are dates in the form of character data
- use minor.ticks and major.ticks function to control the xts plot
- Learnt a big lesson that you can’t apply as.Date function just like that to index(xts) object. It is always better to use strptime function
- as.Date is always applicable to character based input
- apply.monthly, apply.weekly, apply.yearly, period.max, period.min, period.sum, period.prod are some of the useful functions
- endpoints is the one I have used to max
- I need to build my own xts version of function to get an idea of extensibility