R/Diag.R

Defines functions `Diag<-` Diag

Documented in Diag

Diag <- function(x, ...) {
#Diag <- function(x, nrow, ncol) {
  if (inherits(x, "character") & missing(...)) {
    p <- length(x)
    out <- matrix(0, nrow=p, ncol=p)
    diag(out) <- x
  } else {
    out <- diag(x, ...)
    #out <- diag(x, nrow=nrow, ncol=ncol)
  }
  out
}

`Diag<-` <- function(x, value) {
  diag(x) <- value
  x
}

Try the metaSEM package in your browser

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

metaSEM documentation built on Aug. 10, 2023, 1:09 a.m.