[Blotter-commits] r751 - in pkg/FinancialInstrument: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 5 18:46:07 CEST 2011


Author: bodanker
Date: 2011-09-05 18:46:06 +0200 (Mon, 05 Sep 2011)
New Revision: 751

Modified:
   pkg/FinancialInstrument/R/instrument.R
   pkg/FinancialInstrument/man/print.instrument.Rd
Log:
- updated print.instrument using Garrett's excellent suggestion


Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R	2011-09-05 05:06:56 UTC (rev 750)
+++ pkg/FinancialInstrument/R/instrument.R	2011-09-05 16:46:06 UTC (rev 751)
@@ -656,22 +656,11 @@
 #' 
 #' @method print instrument
 #' @S3method print instrument
+#' @author Joshua Ulrich, Garrett See
 #' @keywords internal
 print.instrument <- function(x, ...) {
-  max.name <- max(sapply(names(x), nchar), na.rm=TRUE) + 1
-  for(i in seq_along(x)) {
-    xi <- unlist(x[[i]])
-    nx <- names(x)
-    nxi <- names(xi)
-    if(!is.null(nxi)) {
-      fxi <- format(rbind(nxi,xi))
-      cat(encodeString(nx[i], width=max.name), noquote(fxi[1,]), "\n")
-      cat(encodeString("",    width=max.name), noquote(fxi[2,]), "\n")
-    } else {
-      if(is.null(xi)) xi <- "NULL"
-      cat(encodeString(nx[i], width=max.name), noquote(xi), "\n")
-    }
-  }
+  str(unclass(SPY), comp.str="", no.list=TRUE, give.head=FALSE,
+    give.length=FALSE, give.attr=FALSE, nest.lev=-1, indent.str="")
   invisible(x)
 }
 

Modified: pkg/FinancialInstrument/man/print.instrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/print.instrument.Rd	2011-09-05 05:06:56 UTC (rev 750)
+++ pkg/FinancialInstrument/man/print.instrument.Rd	2011-09-05 16:46:06 UTC (rev 751)
@@ -7,5 +7,8 @@
 \description{
   instrument class print method
 }
+\author{
+  Joshua Ulrich, Garrett See
+}
 \keyword{internal}
 



More information about the Blotter-commits mailing list