Description Usage Arguments Value Examples
View source: R/econModelBase.R
1 | If Then Else
|
1 | ifelse.xts(test, yes, no, ...)
|
test |
xts object |
yes |
if T, select this value |
no |
if F, select this value |
... |
dots passed |
xts object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ## Not run:
# ifelse.xts(If Then Else) examples
xts(matrix(c(T,F),ncol=1), zoo::as.Date(0:1))
[,1]
1970-01-01 TRUE
1970-01-02 FALSE
ifelse.xts(xts(matrix(c(T,F),ncol=1), zoo::as.Date(0:1)), 11, 10)
V1ie
1970-01-01 11
1970-01-02 10
xts(matrix(c(T,F,F,T),ncol=2), zoo::as.Date(0:1))
[,1] [,2]
1970-01-01 TRUE FALSE
1970-01-02 FALSE TRUE
ifelse.xts(xts(matrix(c(T,F,F,T),ncol=2), zoo::as.Date(0:1)), 11, 10)
V1ie V2ie
1970-01-01 11 10
1970-01-02 10 11
ifelse.xts(xts(matrix(c(T,F,F,T),ncol=2), zoo::as.Date(0:1)), c(11,21), c(10,20))
V1ie V2ie
1970-01-01 11 10
1970-01-02 20 21
xts(matrix(c(11,10),ncol=1), zoo::as.Date(0:1))
[,1]
1970-01-01 11
1970-01-02 10
# note: some functions, I must test on the coredata. E.g. is.na
ifelse.xts(xts(matrix(c(11,10),ncol=1), zoo::as.Date(0:1)) > 10 , 21, 20)
V1ie
1970-01-01 21
1970-01-02 20
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.