R/lis.R

Defines functions lis

Documented in lis

lis <-
function( x ){
    N<-length(x);
    if(N==1){rr<-1}
    if(N>1){
        gr<-c(1:N)*0
        gr[1]<-1
        for ( i in 2:N ){
            gr[i] = 1;
            for ( j in 1:(i - 1) ){ 
                if ( x[i] > x[j] ) { gr[i] = max( gr[i], gr[j] + 1) } 
            }
        }
        rr<-max( gr )
    }
    result<-rr
}

Try the LIStest package in your browser

Any scripts or data that you put into this service are public.

LIStest documentation built on May 2, 2019, 12:34 p.m.