Skip to content

Commit

Permalink
Ignore 'auto.assign = FALSE' when 'env' is set
Browse files Browse the repository at this point in the history
The user probably doesn't want 'auto.assign = FALSE' (the default) if
they also set 'env' to a non-null value. Warn if they specify both
'auto.assign = FALSE' and 'env' (not null).

See #33.
  • Loading branch information
joshuaulrich committed Jun 20, 2021
1 parent 541d0fa commit 052c207
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/getDividends.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ function(Symbol,from='1970-01-01',to=Sys.Date(),env=parent.frame(),src='yahoo',
if(exists(Symbol, envir = env, inherits = FALSE)) {
tmp.symbol <- get(Symbol, envir = env)
}
if(!missing(auto.assign) && !isTRUE(auto.assign) && !is.null(env)) {
warning("ignoring 'auto.assign = FALSE' because 'env' is specified")
}
auto.assign <- TRUE
}
if(is.null(env))
auto.assign <- FALSE
Expand Down
4 changes: 4 additions & 0 deletions R/getSplits.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ function(Symbol,from='1970-01-01',to=Sys.Date(),env=parent.frame(),src='yahoo',
if(exists(Symbol, envir = env, inherits = FALSE)) {
tmp.symbol <- get(Symbol, envir = env)
}
if(!missing(auto.assign) && !isTRUE(auto.assign) && !is.null(env)) {
warning("ignoring 'auto.assign = FALSE' because 'env' is specified")
}
auto.assign <- TRUE
}
if(is.null(env))
auto.assign <- FALSE
Expand Down

0 comments on commit 052c207

Please sign in to comment.