Quantmod: Problem with Lo(LOW)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Quantmod: Problem with Lo(LOW)

Keith Sabol-3
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]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Quantmod: Problem with Lo(LOW)

Joshua Ulrich
On Sat, Jun 3, 2017 at 12:10 PM, Keith Sabol <[hidden email]> wrote:

> 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:
>
This has been suggested before, and does not work:
https://github.com/joshuaulrich/quantmod/issues/24

>
> 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]]
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.