[R-SIG-Finance] [PKG-UPDATE] New xts version 0.6-2

Jeff Ryan jeff.a.ryan at gmail.com
Wed Dec 31 17:51:15 CET 2008


R-Finance Users:

I am pleased to announce the much changed extensible time-series
package 'xts', version 0.6-2, has made its way to CRAN.

This update represents a major refactoring, as well as some dramatic
improvements in both speed and memory usage.

These updates make xts faster and more memory efficient than most
common time-series classes available in R, and on par with native
atomic types, yet with all the functionality of xts/zoo.

MAJOR CHANGES

• A rewrite of all internal functionality to utilize custom C code for
most low-level operations.  The result is a 30-10,000 times gain in
speed and memory improvements 2-3x that of most other time-series
classes, including base tools.  Full xts functionality is now
available at the same cost as dealing with atomic classes.

• Binary search for time-based indexing.  Inspired by the improvements
Matt Dowle's data.table make over standard linear searching.  The
result is nearly instant time-based subsetting, regardless of original
data size --- 10 thousand or 100 million observations are equally
fast, linear cost with respect to the resulting subset size. [
limiting factor is the copy ]

• C level code (~3300 lines) offers data handling (merge, cbind,
rbind) that makes use of inherent (required) order in time-series
data.  Optimal computation and memory usage.  Additional C code for
lag, diff, subsetting, Ops, and more.

All indexes are now stored internally as (sub)seconds since the epoch.
 User's can still create and use any of the available time-classes, as
internal conversion hides this level of detail.


MINOR CHANGES

• New xts specific methods for cbind/rbind/lag/diff.
• fts time-series as/reclass tools.
• endpoints (and those functions that use) now handles microseconds
and milliseconds.
• Reclass tool updated for better matching of argument.
• reclass now fails gracefully.

NEW ZOO COMPATIBILITY

• Global option to force lag.xts to match behavior or lag.zoo. [
options(xts.compat.zoo.lag=TRUE) ]
• Now handles zero-width xts objects like zoo (no data, just an index).
• Empty xts objects can be created like zoo does, by calling xts().


NEW FEATURES
merge gains 3 new arguments:
  *join*  ---  Maps to *all* argument, 'left', 'right', 'inner',
'outer', corresponding to database operations
  *retclass*  --- option to return merged object of different class,
or no class.
  *retside*  --- return only left or right side of merged object (2-case only)

At present xts loses the ability to pass a vector of logicals to all=
as zoo can.
See example(merge.xts) for a workaround.


C API/Development
Now able to link packages directly to certain C function in xts, to
allow for direct C-level use. More are being added, as well as
documented.  A working example is included in the package directory in
the 'api_example' directory.

New index tools to efficiently convert index to component data:
 [1] ".index"      ".index<-"    ".indexDate"  ".indexday"   ".indexhour"
 [6] ".indexisdst" ".indexmday"  ".indexmin"   ".indexmon"   ".indexsec"
[11] ".indexwday"  ".indexweek"  ".indexyday"  ".indexyear"

indexFormat(x) allows for printing to match user preferences.

New methods:
as.logical.xts(x, drop=TRUE, ...)
as.double.xts(x, drop=TRUE, ...)
as.complex.xts(x, drop=TRUE, ...)
as.integer.xts(x, drop=TRUE, ...)
Where 'drop=FALSE' recreates the xts object with the coredata
converted to the new type, as storage.mode(x)<- would do.

POSSIBLE ISSUES

Calling attr(x, 'index') will return the POSIX seconds, and _not_ the
expected index class.  index(x) behaves as expected, but code making
use of the former direct access function will cause failure/unexpected
results.

merge/cbind created column names may be inconsistent with column names
created with similar zoo functions.

Certain atomic classes may not work for all xts functions.  Integers
and doubles/numerics have been tested and used in production prior to
release.  Less tested are complex, character objects, and lists.

Please report any inconsistencies/errors/bugs to myself, and I will
address promptly.

Thank you,
Jeff
-- 
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com



More information about the R-SIG-Finance mailing list