R/design.r

Defines functions designLatinSqrSys

Documented in designLatinSqrSys

designLatinSqrSys <- function(order, start = NULL)
{
  #process start argument
  if (is.null(start))
    start <- 1:order
  if (length(unique(start))!= order | !all(start >0 & start <= order))
    stop("start does not consist of order unique values between one and order")
  
  #generate design
  des <- lapply(start, 
                function(k, order)
                {
                  if (k == 1)
                    row <- 1:order
                  else
                    row <- c(1:order)[c(k:order,1:(k-1))]
                  return(row)
                }, order = order)
  des <- unlist(des)
  return(des)
}

Try the dae package in your browser

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

dae documentation built on Aug. 7, 2023, 5:08 p.m.