項目 | サンプル | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
キー列を指定してテーブルの差分を取りたい |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
全列をキーとしてテーブルの差分を取りたい |
|
|
=> |
|
c1("C1") = {1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }; c2("C2") = {10,10,20,20,21,30,32,32,32,40}; table1 = cbind(c1,c2); cc1("CC1") = {1, 2, 2, 3, 3 }; cc2("CC2") = {11,20,21,30,32}; table2 = cbind(cc1,cc2); // key1 = "C2"; key2 = "CC2"; result = sel(not belong(table1(key1), table2(key2)), table1); result2 = sel(not belong(table2(key2), table1(key1)), table2);
|
=> |
|
c1("C1") = {1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }; c2("C2") = {10,10,20,20,21,30,32,32,32,40}; table1 = cbind(c1,c2); cc1("CC1") = {1, 2, 2, 3, 3 }; cc2("CC2") = {11,20,21,30,32}; table2 = cbind(cc1,cc2); // keyList1 = titles(table1); keyList2 = titles(table2); uniqKey1 = paste(table1(keyList1),sep=","); uniqKey2 = paste(table2(keyList2),sep=","); result = sel(not belong(uniqKey1, uniqKey2), table1); result2 = sel(not belong(uniqKey2, uniqKey1), table2);