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 March 26, 2020, 8 p.m.