[Quantmod-commits] r598 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jan 11 21:39:35 CET 2013
Author: jryan
Date: 2013-01-11 21:39:34 +0100 (Fri, 11 Jan 2013)
New Revision: 598
Modified:
pkg/R/getSymbols.R
pkg/R/replot.R
pkg/man/getSymbols.Rd
Log:
o getSymbols warning change. Also including explicit getOption()
check for getSymbols.auto.assign and getSymbols.env. Thanks to Garrett See
for the feedback on getting ready for R 3.0 changes.
o replot now being a bit more careful in plot.new calls. This is
a work-in-progress to allow Rserve to process images generated
via chart_Series. Not a solution yet, though seems to not cause any issue
o updated getSymbols.Rd docs
Modified: pkg/R/getSymbols.R
===================================================================
--- pkg/R/getSymbols.R 2013-01-04 06:40:30 UTC (rev 597)
+++ pkg/R/getSymbols.R 2013-01-11 20:39:34 UTC (rev 598)
@@ -8,23 +8,21 @@
warnings=TRUE,
src="yahoo",
symbol.lookup=TRUE,
- auto.assign=TRUE,
+ auto.assign=getOption('getSymbols.auto.assign',TRUE),
...) {
- if(is.null(.quantmodEnv$options$newEnvmessage)) {
+ if(getOption("getSymbols.warning4.0",TRUE)) {
# transition message for 0.4-0 to 0.5-0
- message(paste(' As of 0.4-0,',sQuote('getSymbols'),'uses env=parent.frame() by default.\n',
- 'This behavior will be phased out in 0.5-0 when the call will check\n',
- 'getOption("getSymbols")$env for default value. If NULL, auto.assign will\n',
- 'be set to FALSE. This message is only shown once per session.',
- '\nSee ?quantmodNEWS for more.'))
- .quantmodEnv$options$newEnvmessage <- TRUE
+ message(paste(
+ ' As of 0.4-0,',sQuote('getSymbols'),'uses env=parent.frame() and\n',
+ 'auto.assign=TRUE by default.\n\n',
+
+ 'This behavior will be phased out in 0.5-0 when the call will\n',
+ 'default to use auto.assign=FALSE. getOption("getSymbols.env") and \n',
+ 'getOptions("getSymbols.auto.assign") are now checked for alternate defaults\n\n',
+ 'This message is shown once per session and may be disabled by setting \n',
+ 'options("getSymbols.warning4.0"=FALSE). See ?getSymbol for more details'))
+ options("getSymbols.warning4.0"=FALSE)
}
- getSymbols_options_ <- function(option) {
- gso <- getOption("getSymbols")
- if(is.list(gso))
- gso[[option]]
- else NULL
- }
importDefaults("getSymbols")
# to enable as-it-was behavior, set this:
# options(getSymbols=list(env=substitute(parent.frame(3))))
@@ -32,8 +30,8 @@
#if(missing(env))
# env <- eval(getOption("getSymbols")$env) ### 0.5-0
- if(missing(env))
- env <- parent.frame(1) ### 0.4-0
+ if(missing(env) && !is.null(getOption("getSymbols.env")) )
+ env <- getOption("getSymbols.env") ### 0.4-0
#env_ <- getSymbols_options_("env")
#if(missing(env) && !is.null(env_))
@@ -714,7 +712,7 @@
next
}
#fr <- read.csv(sym.file)
- fr <- .readRDS(sym.file)
+ fr <- readRDS(sym.file)
if(verbose)
cat("done.\n")
if(!is.xts(fr)) fr <- xts(fr[,-1],as.Date(fr[,1],origin='1970-01-01'),src='rda',updated=Sys.time())
Modified: pkg/R/replot.R
===================================================================
--- pkg/R/replot.R 2013-01-04 06:40:30 UTC (rev 597)
+++ pkg/R/replot.R 2013-01-11 20:39:34 UTC (rev 598)
@@ -4,7 +4,7 @@
Env <- new.env()
Env$frame <- frame
Env$asp <- asp
- Env$usr <- par("usr")
+ Env$usr <- NULL # par("usr")
Env$xlim <- xlim
Env$ylim <- ylim
Env$pad1 <- -0 # bottom padding per frame
@@ -168,7 +168,7 @@
}
# prepare window to draw
- set_window()
+ #set_window()
# return
replot_env <- new.env()
class(replot_env) <- c("replot","environment")
@@ -192,7 +192,7 @@
replot_env$set_ylim <- set_ylim
replot_env$get_ylim <- get_ylim
replot_env$set_pad <- set_pad
- return(replot_env)
+ invisible(replot_env)
} # }}}
str.replot <- function(x, ...) {
Modified: pkg/man/getSymbols.Rd
===================================================================
--- pkg/man/getSymbols.Rd 2013-01-04 06:40:30 UTC (rev 597)
+++ pkg/man/getSymbols.Rd 2013-01-11 20:39:34 UTC (rev 598)
@@ -29,7 +29,7 @@
warnings = TRUE,
src = "yahoo",
symbol.lookup = TRUE,
- auto.assign = TRUE,
+ auto.assign = getOption('getSymbols.auto.assign',TRUE),
...)
loadSymbols(Symbols = NULL,
@@ -39,7 +39,7 @@
warnings = TRUE,
src = "yahoo",
symbol.lookup = TRUE,
- auto.assign = TRUE,
+ auto.assign = getOption('getSymbols.auto.assign',TRUE),
...)
showSymbols(env=parent.frame())
@@ -63,7 +63,8 @@
from external lookup (TRUE) }
\item{auto.assign}{ should results be loaded to \code{env}
If \code{FALSE}, return results instead.
- As of 0.4-0, this is the same as setting env=NULL }
+ As of 0.4-0, this is the same as setting env=NULL.
+ Defaults to \code{TRUE} }
\item{file.path}{ character string of file location }
\item{\dots}{ additional parameters }
}
@@ -93,7 +94,8 @@
to parent.frame(), which preserved the user workspace when
called within another scope.
-\emph{This behavior is expect to change as of 0.5-0, and all results will instead be explicitly returned to the caller
+\emph{This behavior is expect to change as of 0.5-0, and all
+results will instead be explicitly returned to the caller
unless a valid \code{env=} argument is passed or set.}
Many thanks to Kurt Hornik and Achim Zeileis for suggesting this change, and
further thanks to Dirk Eddebuettel for encouraging the move to a more functional
More information about the Quantmod-commits
mailing list