mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 15:43:58 +00: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:
parent
835d077573
commit
fbdc0115e9
@ -405,7 +405,7 @@ mat
|
|||||||
# [2,] 2 5
|
# [2,] 2 5
|
||||||
# [3,] 3 6
|
# [3,] 3 6
|
||||||
# Unlike a vector, the class of a matrix is "matrix", no matter what's in it
|
# 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
|
# Ask for the first row
|
||||||
mat[1,] # 1 4
|
mat[1,] # 1 4
|
||||||
# Perform operation on the first column
|
# Perform operation on the first column
|
||||||
|
Loading…
Reference in New Issue
Block a user