Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将R中的矩阵列作为变量加载?在我这样做之后,我想访问在 for 循环中创建的该变量中的各个行元素,我该如何访问它?矩阵本身只是二维的。
利用[
[
样本矩阵:
> mat=matrix(1:6, 2) > mat [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6
提取第 2 列:
> mat[,2] [1] 3 4
你到底想做什么? for几乎总是错误的方法。
for