[Xts-commits] r729 - pkg/xts/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 16 16:18:17 CEST 2012


Author: bodanker
Date: 2012-09-16 16:18:17 +0200 (Sun, 16 Sep 2012)
New Revision: 729

Modified:
   pkg/xts/R/xts.R
Log:
- Fix error in xts() when x is a 1-column data.frame
- Don't drop dims in xts() when x is a 1-column object


Modified: pkg/xts/R/xts.R
===================================================================
--- pkg/xts/R/xts.R	2012-09-03 22:07:52 UTC (rev 728)
+++ pkg/xts/R/xts.R	2012-09-16 14:18:17 UTC (rev 729)
@@ -60,8 +60,8 @@
 
   if(!is.null(x) && !isOrdered(order.by, strictly=!unique) ) {
     indx <- order(order.by)
-    if(NCOL(x) > 1 || is.matrix(x)) {
-      x <- x[indx,]
+    if(NCOL(x) > 1 || is.matrix(x) || is.data.frame(x)) {
+      x <- x[indx,,drop=FALSE]
     } else x <- x[indx]
     order.by <- order.by[indx]
   }



More information about the Xts-commits mailing list