Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.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,我有两个向量x和y x = c(2, 4, 6, 3, 1.5) y = c(2.2, 1, .5) m = matrix(c(x, y, rep(0, length(x)), rep(1, length(y))), nrow = 2, ncol= length(x) + length(y), byrow = TRUE) 如何根据R中第一行矩阵m的排序对第二行矩阵m进行排序 > res [1] 1 1 0 0 1 0 0 0 您正在寻找订

我有两个向量
x
y

    x = c(2, 4, 6, 3, 1.5)
    y = c(2.2, 1, .5)
    m = matrix(c(x, y, rep(0, length(x)), rep(1, length(y))), 
    nrow = 2, ncol= length(x) + length(y), byrow = TRUE)
如何根据R中第一行矩阵
m
的排序对第二行矩阵
m
进行排序

    > res
   [1] 1 1 0 0 1 0 0 0

您正在寻找
订单
。解释了一些细节

m[2,order(m[1,])]