書名: Machine Learning with R Quick Start Guide作者名: Iván Pastor Sanz本章字數: 38字更新時間: 2021-06-24 16:01:30
Representing matrices
To represent a matrix of n elements with r rows and c columns, the matrix command is used:
m<-matrix(c(1,2,3,4,5,6), nrow=2, ncol=3)
m
## [,1] [,2] [,3]
## [1,] 1 3 5
## [2,] 2 4 6