R/row_count.R

Defines functions row_count

Documented in row_count

##############################################################################
#                                                                            #
#                              ROW COUNTS                                    #
#                                                                            #
##############################################################################

#' @title
#' Number of rows of a vector/matrix
#'
#' @description
#' This function counts the number of rows of a vector or a matrix
#'
#' @param M A vector/matrix
#'
#' @return An integer that gives the number of rows in a vector or a matrix.
#'
#' @usage
#' row_count(M)
#'
#' @examples
#' init()
#' row_count(Q$Q01)
#' row_count(Q$lambda5)
#' row_count(Q$Qt12)
#'
#' @export
#'

row_count <- function(M){
  if (is.null(dim(M))){
    return(NROW(t(M)))
  }
  return(NROW(M))
}

Try the QGameTheory package in your browser

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

QGameTheory documentation built on July 8, 2020, 7:27 p.m.