12 lines
151 B
R
12 lines
151 B
R
# create a 2-times-2 matrix
|
|
mat <- matrix(1:4, 2, 2)
|
|
|
|
# matrix with scalar
|
|
mat + 2
|
|
mat * 2
|
|
mat ^ 2
|
|
|
|
# matrix with matrix
|
|
mat + mat
|
|
mat * mat
|
|
mat ^ mat
|