Here are the first few lines of an R function that works:
teetor <- function(x,y) {
require("quantmod")
require("tseries")
alpha <- getSymbols(x, auto.assign=FALSE)
bravo <- getSymbols(y, auto.assign=FALSE)
t <- as.data.frame(merge(alpha, bravo))
# ... <boring unit root econometric code>
}
When I pass two stock symbols as function parameters, I need to enclose them with quotes:
teetor("GLD", "GDX")
I want to be able to simply type:
teetor(GLD, GDX)
Don't. It's a bad idea to sacrifice clear, simple code just to save a couple of keystrokes. You have created a function that can only be use interactively, not called from another function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With