Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.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 - Fatal编程技术网

R 从另一个矩阵创建矩阵

R 从另一个矩阵创建矩阵,r,R,我有一列矩阵A,我想用A中的一些数字创建一个新的矩阵B。更准确地说 B[1-10] <- A[2-6, and 11-16] 有人知道怎么做吗 提前谢谢 没有例子很难说,但试试这个: B = as.matrix (c(A[2:6,1],A[11:16,1])) 很难说没有例子,但尝试一下: B = as.matrix (c(A[2:6,1],A[11:16,1])) 假设我们有一个示例矩阵: # example 1 column matrix A <- matrix(1:20,

我有一列矩阵A,我想用A中的一些数字创建一个新的矩阵B。更准确地说

B[1-10] <- A[2-6, and 11-16]
有人知道怎么做吗


提前谢谢

没有例子很难说,但试试这个:

B = as.matrix (c(A[2:6,1],A[11:16,1]))

很难说没有例子,但尝试一下:

B = as.matrix (c(A[2:6,1],A[11:16,1]))

假设我们有一个示例矩阵:

# example 1 column matrix
A <- matrix(1:20, ncol = 1)

假设我们有一个示例矩阵:

# example 1 column matrix
A <- matrix(1:20, ncol = 1)

Try B Related post:-是减法,:是序列Try B Related post:-是减法,:是序列A[11-16,1]与[-5,1]相同,表示排除第5行。这不会给出所需的输出。只是打字错误。我是说11点16分@zx8754A[11-16,1]与[-5,1]相同,表示排除第五行。这不会给出所需的输出。只是打字错误。我是说11点16分@zx8754