While calculating SMI() function from TTR Package in R using RStudio, often this error is given: "Error in hmax - lmin : non-numeric argument to binary operator". But after simply closing RStudio - and saving all the workspace - and starting it again, when this function is run, No error is given.
Sample Data:-
> head(a)
# A tibble: 6 × 7
Date Time Open High Low Close Volume
<chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 2012.06.19 14 1.26 1.26 1.26 1.26 4518
2 2012.06.19 15 1.26 1.26 1.26 1.26 5668
3 2012.06.19 16 1.26 1.27 1.26 1.27 5696
4 2012.06.19 17 1.27 1.27 1.27 1.27 5742
5 2012.06.19 18 1.27 1.27 1.27 1.27 3477
6 2012.06.19 19 1.27 1.27 1.27 1.27 4751
The line of code that gives this error (often):-
c = as.data.frame(SMI(a[, c("High", "Low", "Close")]))
Error:-
Error in hmax - lmin : non-numeric argument to binary operator