我有一个3000行50000列的表。从这个数据中,我想制作5个数据集,其中包含10%的原始数据,没有任何重叠(在本例中,3000的10%=300)。我还想从原始数据集中删除重采样的数据集。示例
1.Original data (O)
a. Randomly resampled dataset1 (RD1)
b. Randomly resampled dataset2 (RD2)
c. Randomly resampled dataset3 (RD3)
d. Randomly resampled dataset4 (RD4)
e. Randomly resampled dataset5 (RD5)
2. remove RD from O
a. O - RD1 = New dataset1
b. O - RD2 = New dataset2
c. O - RD3 = New dataset3
d. O - RD4 = New dataset4
e. O - RD5 = New dataset5
我尝试了随机重新抽样,如下所示
^{pr2}$但它有重叠。如何制作不重叠的集合?如何从原始数据集中删除RDs以生成新的数据集?有awk、sed、python或R解决方案吗?在
如果你不想改变原始数据,你可以将一个索引数组随机移动到包含这些行的数组中,然后对前5组300行做任何你想做的事情,然后从剩下的部分中删除它们。在
例如,使用30行输入(数字1->30)而不是3000行:
一。在
^{pr2}$再次证明输出是随机的:
相关问题 更多 >
编程相关推荐