【发布时间】:2015-08-21 01:21:49
【问题描述】:
我有一个包含行号和列号的矩阵“索引”。
Row Column
1 1746
1 1867
1 4631
2 3
2 26
2 28
2 34
2 38
2 47
2 52
2 59
2 75
2 78
2 104
我有另一个矩阵“位置”,由 5000 行纬度/经度值组成。
Row longitude latitude
1 100.148995 18.147936
2 98.968003 18.789907
3 98.967501 18.796631
4 98.924965 18.747545
5 105.791758 21.218454
6 105.851929 21.037073
7 99.862961 20.130128
8 102.825773 17.348081
9 99.078912 18.84856
10 102.825682 17.347978
11 99.078871 18.848615
12 98.931815 18.924331
13 102.825634 17.347986
现在我想在与索引中的列号对应的位置找到行号的纬度/经度值,并以表格的形式将它们连接起来,如下所示
Row Column Latitude Longitude
1 723 Latitude of Row#723 of 'locations' Longitude of Row#723 of 'locations'
1 1746 Latitude of Row#1746 of 'locations' Longitude of Row#1726 of 'locations' .
1 1867 . .
1 4631 . .
2 3 98.967501 18.796631
2 26
2 28
2 34
2 38
2 47
2 52
同样,我想获取与所有值的列号对应的位置。我如何在 R 中做到这一点?
【问题讨论】:
标签: r matrix row latitude-longitude