我很新的R和有一個關於子集的問題和使用該變量中的一個的範圍內值的兩個數據幀之間的重組。所以,我有我的兩個dataframes這樣的:子集和重組dataframes使用data.table包或其他溶液[R]
x y
[1,] 79.00 19.63
[2,] 79.01 19.58
[3,] 79.02 19.57
[4,] 79.03 19.58
[5,] 79.04 19.60
[6,] 79.05 19.65
[7,] 79.06 19.67
[8,] 79.07 19.70
[9,] 79.08 19.67
[10,] 79.09 19.72
和
id min_x max_x
[1,] 7G005-1010-10 79.01 79.06
[2,] 7G100-0001-10 79.02 79.09
[3,] 8S010-1201-10 79.06 79.09
我的目的是把他們兩個結合起來是這樣的:
id x y
7G005-1010-10 79,01 19,58
7G005-1010-10 79,02 19,57
7G005-1010-10 79,03 19,58
7G005-1010-10 79,04 19,6
7G005-1010-10 79,05 19,65
7G005-1010-10 79,06 19,7
7G100-0001-10 79,02 19,57
... ... ...
正如你可以在輸出中看到我的數據框中,我嘗試使用data.table
包來找到解決我的問題的方法。
嗯,如果有人能告訴我如何處理它(有或沒有data.table
)!
預先感謝您。
對不起英文不好。
所以,你試圖根據x的範圍落入id?如果這就是你想要的那麼範圍重疊!第一個id與第二個id重疊,第二個id與第三個重疊。你如何處理這個問題? –
謝謝你輸入和期望的輸出非常明確的問題!這很棒。 :) – Ashe