[Xts-commits] r838 - pkg/xts/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Aug 31 17:40:36 CEST 2014
Author: bodanker
Date: 2014-08-31 17:40:36 +0200 (Sun, 31 Aug 2014)
New Revision: 838
Modified:
pkg/xts/R/index.R
Log:
- Fixes bug #5893 (index<-.xts can produce unsorted index)
Modified: pkg/xts/R/index.R
===================================================================
--- pkg/xts/R/index.R 2014-08-30 15:42:42 UTC (rev 837)
+++ pkg/xts/R/index.R 2014-08-31 15:40:36 UTC (rev 838)
@@ -74,6 +74,10 @@
attr(x, 'index') <- structure(unclass(value)*86400, tclass="Date", tzone="UTC")
else attr(x, 'index') <- as.numeric(as.POSIXct(value))
+ # ensure new index is sorted
+ if(!isOrdered(.index(x)))
+ stop("new index needs to be sorted")
+
# set the .indexCLASS/tclass attribute to the end-user specified class
attr(x, '.indexCLASS') <- class(value)
attr(.index(x), 'tclass') <- class(value)
More information about the Xts-commits
mailing list