Skip to content

Commit 53078c4

Browse files
author
maechler
committed
replacing ifelse(cd, A,B) by e.g. if(cd) A else B
git-svn-id: https://svn.r-project.org/R/trunk@88928 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent a114ec0 commit 53078c4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/library/stats/R/ar.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ ar.burg.default <-
582582
res <- list(order = order, ar = ar, var.pred = var.pred, x.mean = x.mean,
583583
aic = xaic, n.used = n.used, n.obs = n.used, order.max = order.max,
584584
partialacf = partialacf, resid = resid,
585-
method = ifelse(var.method==1L,"Burg","Burg2"),
585+
method = if(var.method == 1L) "Burg" else "Burg2",
586586
series = series, frequency = xfreq, call = match.call())
587587
if(order) {
588588
xacf <- acf(x, type = "covariance", lag.max = order, plot = FALSE)$acf
@@ -650,7 +650,7 @@ function (x, aic = TRUE, order.max = NULL, na.action = na.fail,
650650
res <- list(order = order, ar = ar, var.pred = var.pred, x.mean = x.mean,
651651
aic = xaic, n.used = n.used, n.obs = n.used, order.max = order.max,
652652
partialacf = partialacf, resid = resid,
653-
method = ifelse(var.method == 1L, "Burg", "Burg2"),
653+
method = if(var.method == 1L) "Burg" else "Burg2",
654654
series = series, frequency = xfreq,
655655
call = match.call())
656656
class(res) <- "ar"

src/library/stats/R/ts.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,8 @@ arima.sim <- function(model, n, rand.gen = rnorm,
826826
}
827827
q <- length(model$ma)
828828
if(is.na(n.start)) n.start <- p + q +
829-
ifelse(p > 0, ceiling(6/log(minroots)), 0)
830-
if(n.start < p + q) stop("burn-in 'n.start' must be as long as 'ar + ma'")
829+
if(p > 0) ceiling(6/log(minroots)) else 0
830+
else if(n.start < p + q) stop("burn-in 'n.start' must be as long as 'ar + ma'")
831831
d <- 0
832832
if(!is.null(ord <- model$order)) {
833833
if(length(ord) != 3L) stop("'model$order' must be of length 3")

0 commit comments

Comments
 (0)