[Quantmod-commits] r595 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 1 19:22:00 CET 2013


Author: jryan
Date: 2013-01-01 19:21:59 +0100 (Tue, 01 Jan 2013)
New Revision: 595

Modified:
   pkg/DESCRIPTION
   pkg/R/chart_Series.R
   pkg/R/getDividends.R
   pkg/R/getFinancials.R
   pkg/R/getSplits.R
   pkg/R/replot.R
   pkg/R/saveModels.R
   pkg/R/zzz.R
   pkg/man/getDividends.Rd
   pkg/man/getFinancials.Rd
   pkg/man/getSplits.Rd
Log:
o  removed all fixed 'env' defaults to use parent.frame instead
o  increased version to 0.4-0
o  internal environment object storage for plotting
   and models now use .plotEnv and .quantmodEnv internally


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/DESCRIPTION	2013-01-01 18:21:59 UTC (rev 595)
@@ -1,8 +1,8 @@
 Package: quantmod
 Type: Package
 Title: Quantitative Financial Modelling Framework
-Version: 0.3-24
-Date: 2012-12-27
+Version: 0.4-0
+Date: 2013-01-01
 Author: Jeffrey A. Ryan
 Depends: Defaults, xts(>= 0.9-0), zoo, TTR(>= 0.2), methods
 Suggests: DBI,RMySQL,RSQLite,timeSeries,its

Modified: pkg/R/chart_Series.R
===================================================================
--- pkg/R/chart_Series.R	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/R/chart_Series.R	2013-01-01 18:21:59 UTC (rev 595)
@@ -367,7 +367,7 @@
                     fade(theme$dn.col,clev),
                     fade(theme$up.border,clev),
                     fade(theme$dn.border,clev))),expr=TRUE)
-  assign(".chob", cs, .GlobalEnv)
+  assign(".chob", cs, .plotEnv)
 
   # handle TA="add_Vo()" as we would interactively FIXME: allow TA=NULL to work
   if(!is.null(TA) && nchar(TA) > 0) {
@@ -380,7 +380,7 @@
     }
   }
   }
-  assign(".chob", cs, .GlobalEnv)
+  assign(".chob", cs, .plotEnv)
   cs
 } #}}}
 
@@ -400,7 +400,7 @@
   cols
 }
 
-current.chob <- function() invisible(get(".chob",.GlobalEnv))
+current.chob <- function() invisible(get(".chob",.plotEnv))
 
 use.chob <- function(use=TRUE) {
   options('global.chob'=use) 

Modified: pkg/R/getDividends.R
===================================================================
--- pkg/R/getDividends.R	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/R/getDividends.R	2013-01-01 18:21:59 UTC (rev 595)
@@ -1,5 +1,5 @@
 `getDividends` <-
-function(Symbol,from='1970-01-01',to=Sys.Date(),env=.GlobalEnv,src='yahoo',
+function(Symbol,from='1970-01-01',to=Sys.Date(),env=parent.frame(),src='yahoo',
          auto.assign=FALSE,auto.update=FALSE,verbose=FALSE,...) {
 
   Symbol.name <- ifelse(!is.character(Symbol),

Modified: pkg/R/getFinancials.R
===================================================================
--- pkg/R/getFinancials.R	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/R/getFinancials.R	2013-01-01 18:21:59 UTC (rev 595)
@@ -1,4 +1,4 @@
-getFin <- function(Symbol, env=.GlobalEnv, src="google", auto.assign=TRUE, ...) {
+getFin <- function(Symbol, env=parent.frame(), src="google", auto.assign=TRUE, ...) {
   Symbol <- strsplit(Symbol,";")[[1]]
   if(length(Symbol)>1)
     return(unlist(lapply(Symbol, getFin, env=env, src=src, auto.assign=auto.assign)))
@@ -53,7 +53,7 @@
 }
 
 `.getFin` <-
-function(Symbol, env = .GlobalEnv, src='google', auto.assign = TRUE, ...) {
+function(Symbol, env = parent.frame(), src='google', auto.assign = TRUE, ...) {
   tmp <- tempfile()
   download.file(paste('http://finance.google.com/finance?fstype=ii&q=',Symbol,sep=''),
                 quiet=TRUE,destfile=tmp)

Modified: pkg/R/getSplits.R
===================================================================
--- pkg/R/getSplits.R	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/R/getSplits.R	2013-01-01 18:21:59 UTC (rev 595)
@@ -1,5 +1,5 @@
 `getSplits` <-
-function(Symbol,from='1970-01-01',to=Sys.Date(),env=.GlobalEnv,src='yahoo',
+function(Symbol,from='1970-01-01',to=Sys.Date(),env=parent.frame(),src='yahoo',
          auto.assign=FALSE,auto.update=FALSE,verbose=FALSE,...) {
 
   # Function written by Joshua Ulrich, using

Modified: pkg/R/replot.R
===================================================================
--- pkg/R/replot.R	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/R/replot.R	2013-01-01 18:21:59 UTC (rev 595)
@@ -203,7 +203,8 @@
 print.replot <- function(x, ...) plot(x,...)
 plot.replot <- function(x, ...) {
   plot.new()
-  assign(".chob",x,.GlobalEnv)
+  #assign(".chob",x,.GlobalEnv)
+  assign(".chob",x,.plotEnv)
   cex <- par(cex=x$Env$cex)
   mar <- par(mar=x$Env$mar)
   if(.Device=="X11") # only reasonable way to fix X11/quartz issue
@@ -262,7 +263,7 @@
 }
 
 `+.replot` <- function(e1, e2) {
-  assign(".chob",e1,.GlobalEnv)
+  assign(".chob",e1,.plotEnv)
   e2 <- eval(e2)
   e2
 }

Modified: pkg/R/saveModels.R
===================================================================
--- pkg/R/saveModels.R	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/R/saveModels.R	2013-01-01 18:21:59 UTC (rev 595)
@@ -42,7 +42,7 @@
             this <- eval(parse(text=thisName));
             this <- stripModelData(this);
             thisName <- this at model.id;
-            assign(thisName,this,pos=1);
+            assign(thisName,this,.quantmodEnv);
         }
     }
 

Modified: pkg/R/zzz.R
===================================================================
--- pkg/R/zzz.R	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/R/zzz.R	2013-01-01 18:21:59 UTC (rev 595)
@@ -3,13 +3,17 @@
 #  cat("Version 0.3-7, Revision 461\n")
 #  cat("http://www.quantmod.com\n\n")
 #}
+.plotEnv <- new.env()
+.quantmodEnv <- new.env()
+ 
 quantmodenv <- function() as.environment(".quantmodEnv")
 print.quantmodEnv <- function(x, ...) {
   print("<environment: quantmodEnv>")
 }
 
 .onAttach <- function(libname,pkgname) {
-  attach(NULL, pos=2, name='.quantmodEnv')
+  # --as-cran check is complaining of this, as a NOTE
+  #attach(NULL, name='.quantmodEnv')  
 }
 
 setOldClass("zoo");

Modified: pkg/man/getDividends.Rd
===================================================================
--- pkg/man/getDividends.Rd	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/man/getDividends.Rd	2013-01-01 18:21:59 UTC (rev 595)
@@ -9,7 +9,7 @@
 getDividends(Symbol, 
              from = "1970-01-01",
              to = Sys.Date(), 
-             env = .GlobalEnv, 
+             env = parent.frame(), 
              src = "yahoo", 
              auto.assign = FALSE, 
              auto.update = FALSE, 

Modified: pkg/man/getFinancials.Rd
===================================================================
--- pkg/man/getFinancials.Rd	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/man/getFinancials.Rd	2013-01-01 18:21:59 UTC (rev 595)
@@ -9,7 +9,7 @@
 Cash Flow Statements from Google Finance.
 }
 \usage{
-getFinancials(Symbol, env = .GlobalEnv, src = "google", 
+getFinancials(Symbol, env = parent.frame(), src = "google", 
               auto.assign = TRUE,
               ...)
 

Modified: pkg/man/getSplits.Rd
===================================================================
--- pkg/man/getSplits.Rd	2012-12-31 05:55:29 UTC (rev 594)
+++ pkg/man/getSplits.Rd	2013-01-01 18:21:59 UTC (rev 595)
@@ -9,7 +9,7 @@
 getSplits(Symbol, 
           from = "1970-01-01",
           to = Sys.Date(), 
-          env = .GlobalEnv, 
+          env = parent.frame(), 
           src = "yahoo", 
           auto.assign = FALSE, 
           auto.update = FALSE, 



More information about the Quantmod-commits mailing list