[R] break

Jim Holtman jholtman at gmail.com
Sat Dec 11 22:24:47 CET 2010


It is 'break', not 'break(I)'

Sent from my iPhone

What is the problem you are trying to solve?

On Dec 11, 2010, at 12:17, Serdar Akin <akin1876 at gmail.com> wrote:

> Hi
>
> I'm trying to utilize the break command for breaking the loop when the
> p-value is less than 10 per cent using the urca package. But it does  
> not
> break the loop, anyone that can help me?
>
> library(urca)
> set.seed(1)
> a1 <- runif(100)
> lag.max <- function(object, n = 12){
>    matris <- matrix(NA, nrow = n)
>    for(i in 1:n) {
>       matris[i] <- ur.df(object, lags = i,
>                          type = "trend")@testreg$coefficients[i+3,4]
>       if (i <  0.1) {break(i)}
>   }
>       list(matris = round(matris, 3))
>   }
> a2 <- lag.max(a1)
>
> /With regards
> Serdar
>
>    [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list