[R-SIG-Finance] Lo catches slow
Enrico Schumann
e@ @end|ng |rom enr|co@chum@nn@net
Wed Mar 13 12:14:54 CET 2019
>>>>> "Joshua" == Joshua Ulrich <josh.m.ulrich using gmail.com> writes:
Joshua> On Tue, Mar 12, 2019 at 11:53 PM Ilya Kipnis <ilya.kipnis using gmail.com> wrote:
>>
>> Minimum reproducible example:
>>
>> require(quantmod)
>> require(TTR)
>>
>> getSymbols('SPY')
>> data <- cbind(OHLC(SPY), stoch(HLC(SPY)))
>> head(Lo(data))
>> head(HLC(data))
>>
>> Lo catches both the low from the OHLC object
>> (which it's supposed to), and the slowD column
>> (because it has low in the name), which it isn't
>> supposed to.
>>
Joshua> This is a known issue that is hard to fix. See
Joshua> https://github.com/joshuaulrich/quantmod/issues/24
Perhaps one could add a warning for this case, either
in `Lo` or `has.Lo`?
i <- grep("Low", colnames(x), ignore.case = TRUE)
if (length(i) > 1L)
warning("more than one column match 'low': ",
paste(colnames(x)[i], collapse = " "))
>> This can cause issues down the line with other functions that call
>> functions that search for the Low column which might cause a dimnames error
>> down the line.
>>
Joshua> --
Joshua> Joshua Ulrich | about.me/joshuaulrich
Joshua> FOSS Trading | www.fosstrading.com
Joshua> R/Finance 2019 | www.rinfinance.com
--
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net
More information about the R-SIG-Finance
mailing list