Description Usage Arguments Value Examples
Non-Leading NAs (NLN). Work-around of R CRAN package TTR functions: Error in runSum(x, n) : Series contains non-leading NAs.
1 |
x |
Default none. Required. Single column xts data. |
f |
Default none. Required. TTR function. |
... |
Dots passed to f. |
modified x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
x <- xts::xts(c(NA,1,2,4,NA), zoo::as.Date(0:4))
SMA <- createNLN(x, f = TTR::SMA)
SMA(x, n = 2)
V1nln.SMA.n.2
1970-01-01 NA
1970-01-02 NA
1970-01-03 1.5
1970-01-04 3.0
1970-01-05 0.0
x <- xts::xts(c(NA,10,20,40,NA), zoo::as.Date(0:4))
SMA(x, n = 2)
V1nln.SMA.n.2
1970-01-01 NA
1970-01-02 NA
1970-01-03 15
1970-01-04 30
1970-01-05 0
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.