[Xts-commits] r643 - in pkg/xtsExtra: . R R/xtsdf man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 19 21:42:09 CEST 2012


Author: weylandt
Date: 2012-06-19 21:42:08 +0200 (Tue, 19 Jun 2012)
New Revision: 643

Added:
   pkg/xtsExtra/R/bind.merge.R
   pkg/xtsExtra/R/simpleS3.xtsdf.R
   pkg/xtsExtra/R/subset.print.xtsdf.R
   pkg/xtsExtra/R/xtsdf.R
   pkg/xtsExtra/man/indexClass.Rd
   pkg/xtsExtra/man/xtsdf.Rd
Removed:
   pkg/xtsExtra/R/xtsdf/simpleS3.xtsdf.R
   pkg/xtsExtra/R/xtsdf/subset.print.xtsdf.R
   pkg/xtsExtra/R/xtsdf/xtsdf.R
Modified:
   pkg/xtsExtra/DESCRIPTION
   pkg/xtsExtra/NAMESPACE
   pkg/xtsExtra/man/plot.xts.Rd
Log:
Export basics of xtsdf

Modified: pkg/xtsExtra/DESCRIPTION
===================================================================
--- pkg/xtsExtra/DESCRIPTION	2012-06-19 18:17:07 UTC (rev 642)
+++ pkg/xtsExtra/DESCRIPTION	2012-06-19 19:42:08 UTC (rev 643)
@@ -8,6 +8,6 @@
 	xts package. The package also serves as a development platform
         for the GSoC 2012 xts project, which may eventually end up in
         the xts package.
-Depends: xts (>= 0.8-7)
+Depends: zoo, xts (>= 0.8-7)
 License: GPL-2
 URL: http://r-forge.r-project.org/projects/xts/

Modified: pkg/xtsExtra/NAMESPACE
===================================================================
--- pkg/xtsExtra/NAMESPACE	2012-06-19 18:17:07 UTC (rev 642)
+++ pkg/xtsExtra/NAMESPACE	2012-06-19 19:42:08 UTC (rev 643)
@@ -37,4 +37,41 @@
 S3method(HoltWinters, default)
 S3method(HoltWinters, xts)
 
-## Data frame capability
\ No newline at end of file
+# WHY DON'T DEPENDENCIES COVER THESE IMPORTS? 
+
+importFrom("stats", pacf)
+importFrom("xts", as.xts, indexTZ) 
+importFrom("zoo", index, as.zoo)
+
+## Data frame capability
+
+export("xtsdf")
+export("as.xtsdf")
+
+S3method(as.xtsdf, xts)
+S3method(as.xtsdf, data.frame)
+
+S3method(as.data.frame, xtsdf)
+S3method(as.xts, xtsdf)
+
+S3method(`[`,xtsdf)
+S3method(print, xtsdf)
+S3method(str, xtsdf)
+
+S3method(c, xtsdf)
+S3method(cbind, xtsdf)
+S3method(rbind, xtsdf)
+S3method(merge, xtsdf)
+
+export(is.xtsdf)
+S3method(index, xtsdf)
+S3method(as.list, xtsdf)
+S3method(dim, xtsdf)
+S3method(dimnames, xtsdf)
+S3method(as.zoo, xtsdf)
+S3method(indexTZ, xtsdf)
+
+#### NEED TO MAKE INDEX CLASS A S3 GENERIC FOR NOW
+export("indexClass")
+S3method(indexClass, xts)
+S3method(indexClass, xtsdf)

Added: pkg/xtsExtra/R/bind.merge.R
===================================================================
--- pkg/xtsExtra/R/bind.merge.R	                        (rev 0)
+++ pkg/xtsExtra/R/bind.merge.R	2012-06-19 19:42:08 UTC (rev 643)
@@ -0,0 +1,32 @@
+#   xtsExtra: Extensions to xts during GSOC-2012
+#
+#   Copyright (C) 2012  Michael Weylandt: michael.weylandt at gmail.com
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation, either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+c.xtsdf <- function(...){
+  
+}
+  
+cbind.xtsdf <- function(..., deparse.level = 1){
+  
+}
+
+rbind.xtsdf <- function(..., deparse.level = 1){
+  
+}
+
+merge.xtsdf <- function(x, y, ...) {
+  
+}

Copied: pkg/xtsExtra/R/simpleS3.xtsdf.R (from rev 641, pkg/xtsExtra/R/xtsdf/simpleS3.xtsdf.R)
===================================================================
--- pkg/xtsExtra/R/simpleS3.xtsdf.R	                        (rev 0)
+++ pkg/xtsExtra/R/simpleS3.xtsdf.R	2012-06-19 19:42:08 UTC (rev 643)
@@ -0,0 +1,40 @@
+#   xtsExtra: Extensions to xts during GSOC-2012
+#
+#   Copyright (C) 2012  Michael Weylandt: michael.weylandt at gmail.com
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation, either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+## A collection of simple but useful S3 generics
+
+index.xtsdf <- function(x, ...) index(x[[1]], ...)
+
+as.list.xtsdf <- function(x, ...) unclass(x)
+
+dim.xtsdf <- function(x) c(length(x[[1]]), length(x))
+
+dimnames.xtsdf <- function(x) list(index(x), names(x))
+
+as.zoo.xtsdf <- function(x, ...) as.zoo(as.xts(x, ...), ...)
+
+indexTZ.xtsdf <- function(x, ...) indexTZ(x[[1]])
+
+
+#### NEED TO MAKE INDEX CLASS A S3 GENERIC FOR NOW
+
+indexClass <- function(x) UseMethod("indexClass")
+
+indexClass.xts <- xts::indexClass
+
+indexClass.xtsdf <- function(x) indexClass(x[[1]])
\ No newline at end of file

Copied: pkg/xtsExtra/R/subset.print.xtsdf.R (from rev 642, pkg/xtsExtra/R/xtsdf/subset.print.xtsdf.R)
===================================================================
--- pkg/xtsExtra/R/subset.print.xtsdf.R	                        (rev 0)
+++ pkg/xtsExtra/R/subset.print.xtsdf.R	2012-06-19 19:42:08 UTC (rev 643)
@@ -0,0 +1,57 @@
+#   xtsExtra: Extensions to xts during GSOC-2012
+#
+#   Copyright (C) 2012  Michael Weylandt: michael.weylandt at gmail.com
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation, either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+`[.xtsdf` <- function(x, i, j, drop = FALSE, which.i = FALSE, ...){
+  if(missing(i)) {
+    x <- unclass(x)[j]
+    class(x) <- "xtsdf"
+    return(x)
+  }
+     
+  x <- x[,j]
+     
+  # For now simply loop over x and use i as appropriate
+  ans <- lapply(x, function(x) x[i = i, drop = drop, which.i = which.i, ...])   
+  class(ans) <- "xtsdf"
+  
+  ans
+  
+}
+
+print.xtsdf <- function(x, ...){
+  print(as.data.frame(x, row.names = index(x)), ...)
+}
+
+str.xtsdf <- function(object, ...) {
+  cat(paste("An", sQuote("xtsdf"), "object from", index(first(object[[1]])), 
+            "to", index(last(object[[1]])),"containing",NROW(object),"observations of",NCOL(object),"variables:\n\n"))
+  
+  for(i in seq_len(NCOL(object))){
+    # Should align names more attractively? 
+    
+    cat(" ", names(object)[i],"$: ")
+    str(coredata(object[[i]]))
+  }
+  cat("\n")
+  cat(paste("  Indexed by objects of class: "))
+  cat(paste("[", paste(indexClass(object), collapse = ","), 
+            "] ", sep = ""))
+  cat(paste("TZ: ", indexTZ(object), "\n", sep = ""))
+  if (!is.null(CLASS(object))) 
+    cat(paste("  Original class: '", CLASS(object), "' ", 
+              sep = ""), "\n")
+}

Deleted: pkg/xtsExtra/R/xtsdf/simpleS3.xtsdf.R
===================================================================
--- pkg/xtsExtra/R/xtsdf/simpleS3.xtsdf.R	2012-06-19 18:17:07 UTC (rev 642)
+++ pkg/xtsExtra/R/xtsdf/simpleS3.xtsdf.R	2012-06-19 19:42:08 UTC (rev 643)
@@ -1,40 +0,0 @@
-#   xtsExtra: Extensions to xts during GSOC-2012
-#
-#   Copyright (C) 2012  Michael Weylandt: michael.weylandt at gmail.com
-#
-#   This program is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-## A collection of simple but useful S3 generics
-
-index.xtsdf <- function(x, ...) index(x[[1]], ...)
-
-as.list.xtsdf <- function(x, ...) unclass(x)
-
-dim.xtsdf <- function(x) c(length(x[[1]]), length(x))
-
-dimnames.xtsdf <- function(x) list(index(x), names(x))
-
-as.zoo.xtsdf <- function(x, ...) as.zoo(as.xts(x, ...), ...)
-
-indexTZ.xtsdf <- function(x, ...) indexTZ(x[[1]])
-
-
-#### NEED TO MAKE INDEX CLASS A S3 GENERIC FOR NOW
-
-indexClass <- function(x) UseMethod("indexClass")
-
-indexClass.xts <- xts::indexClass
-
-indexClass.xtsdf <- function(x) indexClass(x[[1]])
\ No newline at end of file

Deleted: pkg/xtsExtra/R/xtsdf/subset.print.xtsdf.R
===================================================================
--- pkg/xtsExtra/R/xtsdf/subset.print.xtsdf.R	2012-06-19 18:17:07 UTC (rev 642)
+++ pkg/xtsExtra/R/xtsdf/subset.print.xtsdf.R	2012-06-19 19:42:08 UTC (rev 643)
@@ -1,57 +0,0 @@
-#   xtsExtra: Extensions to xts during GSOC-2012
-#
-#   Copyright (C) 2012  Michael Weylandt: michael.weylandt at gmail.com
-#
-#   This program is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-`[.xtsdf` <- function(x, i, j, drop = FALSE, which.i = FALSE, ...){
-  if(missing(i)) {
-    x <- unclass(x)[j]
-    class(x) <- "xtsdf"
-    return(x)
-  }
-     
-  x <- x[,j]
-     
-  # For now simply loop over x and use i as appropriate
-  ans <- lapply(x, function(x) x[i = i, drop = drop, which.i = which.i, ...])   
-  class(ans) <- "xtsdf"
-  
-  ans
-  
-}
-
-print.xtsdf <- function(x, ...){
-  print(as.data.frame(x, row.names = index(x)), ...)
-}
-
-str.xtsdf <- function(object, ...) {
-  cat(paste("An", sQuote("xtsdf"), "object from", index(first(object[[1]])), 
-            "to", index(last(object[[1]])),"containing",NROW(object),"observations of",NCOL(object),"variables:\n\n"))
-  
-  for(i in seq_len(NCOL(object))){
-    # Should align names more attractively? 
-    
-    cat(" ", names(object)[i],"$: ")
-    str(coredata(object[[i]]))
-  }
-  cat("\n")
-  cat(paste("  Indexed by objects of class: "))
-  cat(paste("[", paste(indexClass(object), collapse = ","), 
-            "] ", sep = ""))
-  cat(paste("TZ: ", indexTZ(object), "\n", sep = ""))
-  if (!is.null(CLASS(object))) 
-    cat(paste("  Original class: '", CLASS(object), "' ", 
-              sep = ""), "\n")
-}

Deleted: pkg/xtsExtra/R/xtsdf/xtsdf.R
===================================================================
--- pkg/xtsExtra/R/xtsdf/xtsdf.R	2012-06-19 18:17:07 UTC (rev 642)
+++ pkg/xtsExtra/R/xtsdf/xtsdf.R	2012-06-19 19:42:08 UTC (rev 643)
@@ -1,71 +0,0 @@
-#   xtsExtra: Extensions to xts during GSOC-2012
-#
-#   Copyright (C) 2012  Michael Weylandt: michael.weylandt at gmail.com
-#
-#   This program is free software: you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation, either version 3 of the License, or
-#   (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-### A first attempt at multi-data-type-xts objects
-### For now implemented entirely in R, move to C over time
-
-### Implementation model: 
-###   1) List of xts objects, each comprising a single column and a single data type
-###   2) Pseudo-inherits to data.frame with a helpful downgrade ?
-###   3) Need to handle ... for both xts() and data.frame() -- right now, deferring to data.frame() mostly
-
-xtsdf <- function(..., order.by = index(x), frequency = NULL, unique = TRUE, tzone = Sys.getenv("TZ"), 
-                  stringsAsFactors = default.stringsAsFactors(), check.names = TRUE) {
-  # xtsdf constructor function
-  # uses xts() and data.frame() code instead of rewriting all the name handling
-  
-  as.xtsdf(data.frame(..., stringsAsFactors = stringsAsFactors, check.names = check.names), 
-           order.by = order.by, frequency = frequency, unique = unique, tzone = tzone)
-}
-
-as.xtsdf <- function(x, ...) UseMethod("as.xtsdf")
-
-as.xtsdf.xts <- function(x, ...){
-  # Easy case -- split by list and add S3 class
-  ans <- as.list(x)
-  class(ans) <- "xtsdf"
-  ans
-}
-
-as.xtsdf.data.frame <- function(x, order.by, ..., frequency = NULL, unique = TRUE, tzone = Sys.getenv("TZ")){
-  # Next easiest case -- 
-  #   Take data frame and order.by argument and construct xts objects directly
-  #   Also allow order.by = "rownames" to use x's rownames
-  
-  if(!is.timeBased(order.by)) {
-    if(order.by == "rownames") {
-      order.by <- rownames(x)
-    }
-    order.by <- as.POSIXct(order.by, ...)
-  }
-  
-  ans <- lapply(as.list(d), function(x) xts(x, order.by, frequency = frequency, unique = unique, tzone = tzone))
-  class(ans) <- "xtsdf"
-  
-  ans
-}
-
-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", c(x, list(row.names = row.names, check.names = optional, ...)))
-}
-
-as.xts.xtsdf <- function(x, ...){
-  xts(do.call("cbind", x), ...)
-}
-

Copied: pkg/xtsExtra/R/xtsdf.R (from rev 640, pkg/xtsExtra/R/xtsdf/xtsdf.R)
===================================================================
--- pkg/xtsExtra/R/xtsdf.R	                        (rev 0)
+++ pkg/xtsExtra/R/xtsdf.R	2012-06-19 19:42:08 UTC (rev 643)
@@ -0,0 +1,72 @@
+#   xtsExtra: Extensions to xts during GSOC-2012
+#
+#   Copyright (C) 2012  Michael Weylandt: michael.weylandt at gmail.com
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation, either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+### A first attempt at multi-data-type-xts objects
+### For now implemented entirely in R, move to C over time
+
+### Implementation model: 
+###   1) List of xts objects, each comprising a single column and a single data type
+###   2) Pseudo-inherits to data.frame with a helpful downgrade ?
+###   3) Need to handle ... for both xts() and data.frame() -- right now, deferring to data.frame() mostly
+
+xtsdf <- function(..., order.by = index(x), frequency = NULL, unique = TRUE, tzone = Sys.getenv("TZ"), 
+                  stringsAsFactors = default.stringsAsFactors(), check.names = TRUE) {
+  # xtsdf constructor function
+  # uses xts() and data.frame() code instead of rewriting all the name handling
+  x <- data.frame(..., stringsAsFactors = stringsAsFactors, check.names = check.names)
+  as.xtsdf(x, order.by = order.by, frequency = frequency, unique = unique, tzone = tzone)
+}
+
+is.xtsdf <- function(x) inherits(x, "xtsdf")
+
+as.xtsdf <- function(x, ...) UseMethod("as.xtsdf")
+
+as.xtsdf.xts <- function(x, ...){
+  # Easy case -- split by list and add S3 class
+  ans <- as.list(x)
+  class(ans) <- "xtsdf"
+  ans
+}
+
+as.xtsdf.data.frame <- function(x, order.by, ..., frequency = NULL, unique = TRUE, tzone = Sys.getenv("TZ")){
+  # Next easiest case -- 
+  #   Take data frame and order.by argument and construct xts objects directly
+  #   Also allow order.by = "rownames" to use x's rownames
+  
+  if(!is.timeBased(order.by)) {
+    if(order.by == "rownames") {
+      order.by <- rownames(x)
+    }
+    order.by <- as.POSIXct(order.by, ...)
+  }
+  
+  ans <- lapply(as.list(x), function(x) xts(x, order.by = order.by, frequency = frequency, unique = unique, tzone = tzone))
+  class(ans) <- "xtsdf"
+  
+  ans
+}
+
+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", c(as.list(x), list(row.names = row.names, check.names = optional, ...)))
+}
+
+as.xts.xtsdf <- function(x, ...){
+  xts(do.call("cbind", x), ...)
+}
+

Added: pkg/xtsExtra/man/indexClass.Rd
===================================================================
--- pkg/xtsExtra/man/indexClass.Rd	                        (rev 0)
+++ pkg/xtsExtra/man/indexClass.Rd	2012-06-19 19:42:08 UTC (rev 643)
@@ -0,0 +1,15 @@
+\name{indexClass}
+\alias{indexClass}
+\title{ Extracting the Class of an xtsdf Index }
+\description{
+Generic functions to extract, replace, and format the class of the index
+of an xtsdf object.
+}
+\usage{
+indexClass(x)
+}
+\arguments{
+  \item{x}{ xts or xtsdf object }
+}
+\details{Provides a generic over the \code{indexClass} function of \code{xts}.}
+\author{ Michael Weylandt }

Modified: pkg/xtsExtra/man/plot.xts.Rd
===================================================================
--- pkg/xtsExtra/man/plot.xts.Rd	2012-06-19 18:17:07 UTC (rev 642)
+++ pkg/xtsExtra/man/plot.xts.Rd	2012-06-19 19:42:08 UTC (rev 643)
@@ -15,21 +15,19 @@
                        ...)
 }
 \arguments{
-  \item{x}{ an \code{xts} object }
-  \item{y}{ an \code{xts} object or NULL }
-  \item{screens}{ factor (or coerced to factor) whose levels specify which graph each series is to 
-  	be plotted in. If not specified, then defaults to a single series per screen for
-  	\code{type} not \code{"candles"} or \code{"bars"} See examples.}
+  \item{x}{an \code{xts} object}
+  \item{y}{an \code{xts} object or \code{NULL}}
+  \item{screens}{factor (or coerced to factor) whose levels specify which graph each series is to be plotted in. If not specified, then defaults to a single series per screen for \code{type} not \code{"candles"} or \code{"bars"} See examples.}
   \item{layout.screens}{ Matrix (in a form that could be passed to layout) which arranges screens.}
-  \item{auto.grid}{ should grid lines be drawn }
-  \item{major.ticks}{ should major tickmarks be drawn and labeled }
-  \item{minor.ticks}{ should minor tickmarks be drawn }
-  \item{major.format}{ passed along to axTicksByTime. See also }
-  \item{bar.col}{ the color of the bars when type is \sQuote{bars} or \sQuote{candles} }
-  \item{candle.col}{ the color of the candles when type is \sQuote{candles} }
-  \item{xy.labels}{ label points in scatterplot?}
-  \item{xy.lines}{ connect points in scatterplot?}
-  \item{\dots}{ additional graphical arguments }
+  \item{auto.grid}{should grid lines be drawn}
+  \item{major.ticks}{should major tickmarks be drawn and labeled}
+  \item{minor.ticks}{should minor tickmarks be drawn}
+  \item{major.format}{passed along to axTicksByTime.}
+  \item{bar.col}{the color of the bars when type is \sQuote{bars} or \sQuote{candles}}
+  \item{candle.col}{the color of the candles when type is \sQuote{candles}}
+  \item{xy.labels}{label points in scatterplot?}
+  \item{xy.lines}{connect points in scatterplot?}
+  \item{\dots}{additional graphical arguments}
 }
 \details{
 Mainly used to draw time-series plots with sensible x-axis labels, it

Added: pkg/xtsExtra/man/xtsdf.Rd
===================================================================
--- pkg/xtsExtra/man/xtsdf.Rd	                        (rev 0)
+++ pkg/xtsExtra/man/xtsdf.Rd	2012-06-19 19:42:08 UTC (rev 643)
@@ -0,0 +1,63 @@
+\name{xtsdf}
+\alias{xtsdf}
+\alias{is.xtsdf}
+\alias{as.xtsdf}
+\title{ Create Or Test For An xtsdf Time-Series Object }
+\description{
+Constructor function for creating an extensible time-series data.frame object.
+
+\code{xtsdf} is used to create an \code{xtsdf} object from raw data inputs and \code{as.xtsdf} is used for coercion to the same.
+}
+\usage{
+xtsdf(..., order.by = index(x), frequency = NULL, unique = TRUE, tzone = Sys.getenv("TZ"), stringsAsFactors = default.stringsAsFactors(), check.names = TRUE)
+
+as.xtsdf(x, ...)
+
+is.xtsdf(x)
+}
+
+\arguments{
+  \item{\dots}{ Columns of the resulting \code{xtsdf} object. Names will be extracted as with \code{data.frame}}
+  \item{order.by}{ a corresponding vector of unique times/dates - must be
+of a known time-based class. See details of \code{xts}.}
+  \item{frequency}{ numeric indicating frequency of \code{order.by}. See details of \code{xts}. }
+  \item{unique}{ should index be checked for unique time-stamps? }
+  \item{tzone}{ time zone of series }
+  \item{stringsAsFactors}{ Should strings be converted to factors?}
+  \item{check.names}{Should column names be made syntactically correct?}
+  \item{x}{An object to be tested or coerced to class \code{xtsdf}.}
+}
+\details{
+An \code{xtsdf} object creates a time ordered \code{data.frame} like object; internally it is implemented as a list of \code{xts} objects, but it should behave like a \code{data.frame} rather transparently. The class is still under heavy development and feedback is welcome. Imporantly, this now allows \code{xts}-like behavior for objects with different column classes.
+
+
+
+Subsetting inherits ISO8601 subsetting from \code{xts} as well as standard R subsetting. Double bracket (\code{[[}) subsetting inherits from the underlying list structure. Note that the default for subsetting is \code{drop = FALSE} following \code{xts} rather than \code{data.frame}. This is subject to change.
+
+}
+\value{
+An S3 object of class \code{xtsdf}. 
+}
+
+\author{Michael Weylandt}
+
+\seealso{ \code{help("xts")} }
+\examples{
+data(sample_matrix)
+sample.xtsdf <- xtsdf(fac = letters[sample(26, 100, replace = TRUE)], x = rnorm(100), y = abs(rnorm(100)), order.by = as.Date("2012-06-19") + 1:100)
+
+class(sample.xtsdf)
+str(sample.xtsdf)
+
+head(sample.xtsdf)  
+
+sample.xtsdf['2012']  # all of 2012
+sample.xtsdf['2007-07/']  # July 2012 to the end of the data set
+sample.xtsdf['2007-07/2007-08']  # March 2007 to August of 2007
+sample.xtsdf['/'] # the whole data set
+
+sample.xtsdf[["x"]]
+
+sample.xtsdf[,"fac"]
+}
+\keyword{ utilities }



More information about the Xts-commits mailing list