[Xts-commits] r638 - pkg/xtsExtra/R/xtsdf

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 19 18:32:23 CEST 2012


Author: weylandt
Date: 2012-06-19 18:32:23 +0200 (Tue, 19 Jun 2012)
New Revision: 638

Modified:
   pkg/xtsExtra/R/xtsdf/xtsdf.R
Log:
sapply -> lapply and a few other small bug fixes in constructors

Modified: pkg/xtsExtra/R/xtsdf/xtsdf.R
===================================================================
--- pkg/xtsExtra/R/xtsdf/xtsdf.R	2012-06-19 16:15:08 UTC (rev 637)
+++ pkg/xtsExtra/R/xtsdf/xtsdf.R	2012-06-19 16:32:23 UTC (rev 638)
@@ -53,7 +53,7 @@
     order.by <- as.POSIXct(order.by, ...)
   }
   
-  ans <- sapply(as.list(d), function(x) xts(x, order.by, frequency = frequency, unique = unique, tzone = tzone))
+  ans <- lapply(as.list(d), function(x) xts(x, order.by, frequency = frequency, unique = unique, tzone = tzone))
   class(ans) <- "xtsdf"
   
   ans
@@ -62,9 +62,14 @@
 as.data.frame.xtsdf <- function(x, row.names = NULL, optional = FALSE, ...){
   row.names <- if(is.null(row.names)) index(x) else row.names
   
-  do.call("data.frame", list(x, row.names = row.names, check.names = optional, ...))
+  do.call("data.frame", c(x, list(row.names = row.names, check.names = optional, ...)))
 }
 
 as.xts.xtsdf <- function(x, ...){
   xts(do.call("cbind", x), ...)
-}
\ No newline at end of file
+}
+
+index.xtsdf <- function(x, ...) index(x[[1]], ...)
+
+as.list.xtsdf <- function(x, ...) unclass(x)
+



More information about the Xts-commits mailing list