R/mysort.R

Defines functions mysort

mysort<-function(x)
  {
    # Sorts rows and cols of incoming dataframe x into/
    # an order for which it is easier to write the likelihood function
    nvars<-ncol(x)
    powers<-as.integer(2^((nvars-1):0))
    binrep<-ifelse(is.na(x),0,1)
    decrep<-binrep %*% powers
    sorted<-x[order(decrep),]
    decrep<-decrep[order(decrep)]

    list(sorted.data=sorted, freq=as.vector(table(decrep)))
  }

Try the backShift package in your browser

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

backShift documentation built on July 2, 2020, 4:01 a.m.