R/Indexing.R

Indexing <- function (n) {
  
  p <- n * (n + 1) / 2
  mtx <- matrix(0, n, n)
  mtx[lower.tri(mtx, diag = TRUE)] <- 1:p
  mtx <- mtx + t(mtx) - diag(diag(mtx))
  return(c(mtx))
}

Try the JSM package in your browser

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

JSM documentation built on Sept. 4, 2020, 1:08 a.m.