I have a data.table called prices that has 3 columns: ticker, date and price. I have run
setkey(prices,ticker,date)
If I do this from the code, it works
prices[list("MSFT",as.Date("2013-01-15")]
returning only the row for MSFT in 2013-01-15 However, if I write this function
getPrice <- function(ticker,date) {
prices[list(ticker,date)]
}
it returns the whole data.table I suspect that it has something to do with scoping in the i parameter, but I can't get it to work. How do I query the data.table if I don't know the parameters in advance?