-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcol_count.R
34 lines (32 loc) · 882 Bytes
/
col_count.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
##############################################################################
# #
# COLUMN COUNTS #
# #
##############################################################################
#' @title
#' Number of columns of a vector/matrix
#'
#' @description
#' This function counts the number of columns of a vector or a matrix
#'
#' @param M A vector/matrix
#'
#' @usage
#' col_count(M)
#'
#' @return An integer that gives the number of columns in a vector or a matrix.
#'
#' @examples
#' init()
#' col_count(Q$Q11)
#' col_count(Q$lambda4)
#' col_count(Q$I2)
#'
#' @export
#'
col_count <- function(M){
if (is.null(dim(M))){
return(NCOL(t(M)))
}
return(NCOL(M))
}