Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何制作分块矩阵?_R_Dataframe_Matrix - Fatal编程技术网

R 如何制作分块矩阵?

R 如何制作分块矩阵?,r,dataframe,matrix,R,Dataframe,Matrix,假设我有下面的矩阵 1 2 3 4 5 6 7 8 9 我想制作一个块矩阵,如: 1 2 3 0 0 0 0 0 0 0 0 0 4 5 6 0 0 0 0 0 0 0 0 0 7 8 9 0 0 0 0 0 0 0 0

假设我有下面的矩阵

         1   2   3
         4   5   6
         7   8   9
我想制作一个块矩阵,如:

         1   2   3   0   0    0   0   0   0   0    0   0  
         4   5   6   0   0    0   0   0   0   0    0   0
         7   8   9   0   0    0   0   0   0   0    0   0
         0   0   0   1   2    3   0   0   0   0    0   0 
         0   0   0   4   5    6   0   0   0   0    0   0
         0.  0   0   7   8    9   0   0   0   0    0   0   
         0   0   0   0    0   0   1   2   3   0    0   0    
         0   0   0   0    0   0   4   5   6   0    0   0   
         0   0   0   0    0   0   7   8   9   0    0   0   
         0   0    0   0   0   0   0   0   0   1    2   3   
         0   0    0   0   0   0   0   0   0   4    5   6   
         0   0    0   0   0   0   0.  0   0   7    8   9     
我做了以下工作:

   BigKernel<-Matrix::bdiag(replicate(4, m1, simplify = FALSE))
这是错误的。而类型(Bigkernel)是S4


如何生成矩阵?

R
区分大小写
BigKernel
BigKernel
是不同的

as.matrix(BigKernel)

应该工作

R
区分大小写
BigKernel
BigKernel
是不同的

as.matrix(BigKernel)
应该有用