R/dg.R

Defines functions dg

Documented in dg

#' @export

dg <- function(x) {
  if (length(x) == 1) {
    return(x)
  }
  if (is.vector(x) || nrow(x) == 1 || ncol(x) == 1) {
    return(diag(c(x)))
  } else {
    return(diag(x))
  }
}

Try the CGE package in your browser

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

CGE documentation built on July 8, 2020, 5:16 p.m.