Getting the Modulus of the Determinant of a Matrix in R Programming - determinant() Function Last Updated : 03 Jun, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report determinant() function in R Language is a generic function that returns separately the modulus of the determinant, optionally on the logarithm scale, and the sign of the determinant. Syntax: determinant(x, logarithm = TRUE, ...) Parameters: x: matrix logarithm: if TRUE (default) return the logarithm of the modulus of the determinant Example 1: Python3 # R program to illustrate # determinant function # Initializing a matrix with # 3 rows and 3 columns x <- matrix(c(3, 2, 6, -1, 7, 3, 2, 6, -1), 3, 3) # Getting the matrix representation x # Calling the determinant() function determinant(x) Output: [, 1] [, 2] [, 3] [1, ] 3 -1 2 [2, ] 2 7 6 [3, ] 6 3 -1 $modulus [1] 5.220356 attr(, "logarithm") [1] TRUE $sign [1] -1 attr(, "class") [1] "det" Example 2: Python3 # R program to illustrate # determinant function # Initializing a matrix with # 2 rows and 2 columns x <- matrix(c(1, 2, 3, 4), 2, 2) # Getting the matrix representation x # Calling the determinant() function determinant(x, logarithm = FALSE) Output: [, 1] [, 2] [1, ] 1 3 [2, ] 2 4 $modulus [1] 2 attr(, "logarithm") [1] FALSE $sign [1] -1 attr(, "class") [1] "det" Comment More infoAdvertise with us Next Article Getting a Matrix of number of rows in R Programming - row() Function K Kanchan_Ray Follow Improve Article Tags : R Language R Matrix-Function Similar Reads Getting the Determinant of the Matrix in R Programming - det() Function det() function in R Language is used to calculate the determinant of the specified matrix. Syntax: det(x, ...) Parameters: x: matrix Example 1: Python3 # R program to illustrate # det function # Initializing a matrix with # 3 rows and 3 columns x <- matrix(c(3, 2, 6, -1, 7, 3, 2, 6, -1), 3, 3) # 1 min read Getting a Matrix of number of columns in R Programming - col() Function col() function in R Language is used to get a matrix which contains the number of columns of the matrix passed to it as argument. Syntax: col(x, as.factor=FALSE) Parameters: x: matrix as.factor: a logical value indicating whether the value should be returned as a factor of column labels (created if 2 min read Getting a Matrix of number of rows in R Programming - row() Function In this article, we will discuss how to find the number of rows and columns in a matrix in R Programming Language. nrow() Function in Rnrow() function in R Language is used to get the row number of a matrix. Syntax: row(x, as.factor=FALSE) Parameters:x: matrixas.factor: a logical value indicating w 2 min read Calculate Trace of a Matrix in R Programming - tr() Function tr() function in R Language is used to calculate the trace of a matrix. Trace of a matrix is the sum of the values on the main diagonal(upper left to lower right) of the matrix. Syntax: tr(x) Parameters: x: Matrix Example 1: Python3 1== # R program to calculate # trace of a matrix # Loading library 1 min read Finding Inverse of a Matrix in R Programming - inv() Function inv() function in R Language is used to calculate inverse of a matrix. Note: Determinant of the matrix must not be zero Syntax: inv(x) Parameters: x: Matrix Example 1: Python3 1== # R program to calculate # inverse of a matrix # Loading library library(matlib) # Create 3 different vectors. a1 <- 1 min read Calculate the Mean of each Column of a Matrix or Array in R Programming - colMeans() Function colMeans() function in R Language is used to compute the mean of each column of a matrix or array. Syntax: colMeans(x, dims = 1) Parameters: x: array of two or more dimensions, containing numeric, complex, integer or logical values, or a numeric data frame dims: integer value, which dimensions are r 2 min read Like