Description Usage Arguments Details Author(s) See Also Examples
Get data from env
ironment, apply a
FUN
ction, and re-assign the results.
1 2 | gaa(Symbols, FUN, ..., env = .GlobalEnv, store.to = env,
invisible = FALSE)
|
Symbols |
names of xts objects |
FUN |
quoted or unquoted name of function to be applied |
env |
environment where data is stored (.GlobalEnv) |
store.to |
environment in which to store the
results. By default it is the same as |
... |
arguments to pass through to |
invisible |
TRUE/FALSE. If true, nothing is
returned, otherwise, |
FUN
is intended to be something like Cl
or
to.daily
as the results are stored in objects with
the same name as Symbols
Garrett See
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
s <- c('SPY', 'DIA', 'QQQ')
getSymbols(s, from='2011-01-01', to='2011-06-01', src='yahoo')
.cl <- new.env()
gaa(s, Cl, store.to=.cl)
head(.cl$SPY)
head(SPY)
gaa("SPY", adjustOHLC, symbol.name="SPY")
head(SPY)
## Need to loop for functions like adjustOHLC that use
## deparse(substitute(...)) if calling with more than 1 symbol
sapply(s[2:3], function(x) gaa(x, adjustOHLC, symbol.name=x))
## Clean up
rm('s', '.cl', 'SPY', 'DIA', 'QQQ')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.