Skip to content

Lo catches slow

3 messages · Ilya Kipnis, Joshua Ulrich, Enrico Schumann

#
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.

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.
#
On Tue, Mar 12, 2019 at 11:53 PM Ilya Kipnis <ilya.kipnis at gmail.com> wrote:
This is a known issue that is hard to fix.  See
https://github.com/joshuaulrich/quantmod/issues/24

  
    
#

        
Joshua> On Tue, Mar 12, 2019 at 11:53 PM Ilya Kipnis <ilya.kipnis at 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