[R-SIG-Finance] Quantmod: Problem with Lo(LOW)

Keith Sabol sabolkj at gmail.com
Sat Jun 3 19:10:23 CEST 2017


There appears to be a problem with Lo() when used with ticker "LOW".

library(quantmod)

getSymbols("LOW")
[1] "LOW"
> adjustOHLC(LOW)
Error in `-.default`(Lo(x), Cl(x)) : non-conformable arrays
> head(LOW)
           LOW.Open LOW.High LOW.Low LOW.Close LOW.Volume LOW.Adjusted
2007-01-03    31.21    32.31   31.15     32.04   14143200        32.04
2007-01-04    32.40    32.50   31.61     32.18    8351900        32.18
2007-01-05    32.16    32.41   31.59     31.79    8295600        31.79
2007-01-08    31.62    31.82   31.13     31.70    6423400        31.70
2007-01-09    31.76    32.05   31.69     31.87    5053300        31.87
2007-01-10    31.71    32.59   31.70     32.47    8741800        32.47
> Lo
function (x)
{
    if (has.Lo(x))
        return(x[, grep("Low", colnames(x), ignore.case = TRUE)])
    stop("subscript out of bounds: no column name containing \"Low\"")
}
<environment: namespace:quantmod>
>

head(LOW[, grep("Low", colnames(LOW), ignore.case = TRUE)])
           LOW.Open LOW.High LOW.Low LOW.Close LOW.Volume LOW.Adjusted
2007-01-03    31.21    32.31   31.15     32.04   14143200        32.04
2007-01-04    32.40    32.50   31.61     32.18    8351900        32.18
2007-01-05    32.16    32.41   31.59     31.79    8295600        31.79
2007-01-08    31.62    31.82   31.13     31.70    6423400        31.70
2007-01-09    31.76    32.05   31.69     31.87    5053300        31.87
2007-01-10    31.71    32.59   31.70     32.47    8741800        32.47

One viable remedy appears to be adding a period before "Low" in the grep
line:


head(LOW[, grep(".Low", colnames(LOW), ignore.case = TRUE)])
           LOW.Low
2007-01-03   31.15
2007-01-04   31.61
2007-01-05   31.59
2007-01-08   31.13
2007-01-09   31.69
2007-01-10   31.70
>

Hope this helps.

Thanks for your great work on this package Josh.

Keith

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list