Description Usage Arguments Value Examples
1 2 3 4 5 6 7 8 9 10 11 | This is a wrapper over the R CRAN package quantmod function getSymbols
with the additional paramter source.envir.
Get some Symbols from an environment (source.envir).
It will search first in (source.envir).
If the Symbol is not found in the enviroment (source.envir),
then it gets the Symbol from elsewhere.
NOTE: do not do a call with paramters: ("source.envir = e, "env = e")
when auto.assign = TRUE(default).
GetSymbolsEnv places Symbols into "env = e"
|
1 2 3 4 5 6 7 8 9 10 11 12 |
Symbols |
Character vector. Required. Specifies the names of each symbol to be loaded. |
env |
Environment. Default is parent.frame(). Where to create objects. Setting env=NULL is equal to auto.assign=FALSE. |
reload.Symbols |
Logical. Default is FALSE. To reload current symbols in specified environment. |
verbose |
Logical. Default is FALSE. To turn on status of retrieval. |
warnings |
Logical. Default is TRU. To turn on warnings. |
src |
Character string. Default is "yahoo". Specifying sourcing method. |
symbol.lookup |
Logical. Default is TRUE. Retrieve symbol's sourcing method from external lookup. |
auto.assign |
Logical. Default is getOption("getSymbols.auto.assign", TRUE). Should results be loaded to env. If FALSE, return results instead. As of 0.4-0, this is the same as setting env=NULL. Defaults to TRUE. |
source.envir |
Environment. Default is NULL. If set to an Environment, will first(1) try to find the Symbol(s) in the Environment. If the Symbol(s) are not found in the environment, then second(2) the Symbol(s) are (tried to be) acquired using the R CRAN package quantmod function getSymbols. |
... |
Dots passed to the sourcing method. |
Called for its side-effect with env set to a valid environment and auto.assign=TRUE, getSymbols will load into the specified env one object for each Symbol specified, with class defined by return.class. Presently this may be ts, zoo, xts, or timeSeries. If env=NULL or auto.assign=FALSE an object of type return.class will be returned.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
e <- new.env(parent = emptyenv())
# Symbols are loaded into the environment "e".
quantmod::getSymbols(list(AAPL = "yahoo"), env = e)
ls.str(envir = e)
# Instead of "yahoo", try first(1) get the Symbol(s) from the source.envir
# if not found in "e", then try to get the Symbol(s) from "yahoo"
AAPLSymbol <- getSymbolsEnv(list(AAPL = "yahoo"),
auto.assign = FALSE, source.envir = e)
str(AAPLSymbol)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.