R/uppertriang.R

Defines functions uppertriang

Documented in uppertriang

#' get values of upper triangle from matrix
#' @export
#' @param mat matrix
#' @param diag default = FALSE
#' @examples
#'
#' t = matrix(1:25,ncol=5)
#' uppertriang(t)
uppertriang <- function(mat,diag=FALSE){
  res<-mat[upper.tri(mat,diag=diag)]
  return( c(unlist(res)) )
}

Try the quantable package in your browser

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

quantable documentation built on May 2, 2019, 4:05 p.m.