且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

结合矩阵分解成R中的数组

更新时间:2021-12-16 06:29:01

这里的两个例子。你可以很容易地扩展这个八

here's the example for two. you can easily extend this to eight

# create two matricies with however many rows and columns
x <- matrix( 1:9 , 3 , 3 )
y <- matrix( 10:18 , 3 , 3 )
# look at your starting data
x
y

# store both inside an array, with the same first two dimensions,
# but now with a third dimension equal to the number of matricies
# that you are combining
z <- array( c( x , y ) , dim = c( 3 , 3 , 2 ) )

# result
z