1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-19 13:02:14 +02:00

Update return of class(mat) according to R 4.0.0

A matrix is the special case of a two-dimensional ‘array’.  Since R 4.0.0, ‘inherits(m, "array")’ is true for a ‘matrix’ ‘m’, which makes class(mat) return "matrix" "array", not only "matrix" as before.
This commit is contained in:
Marcel Ribeiro Dantas
2022-04-09 00:14:18 +02:00
committed by GitHub
parent 835d077573
commit fbdc0115e9

View File

@@ -405,7 +405,7 @@ mat
# [2,] 2 5
# [3,] 3 6
# Unlike a vector, the class of a matrix is "matrix", no matter what's in it
class(mat) # => "matrix"
class(mat) # => "matrix" "array"
# Ask for the first row
mat[1,] # 1 4
# Perform operation on the first column