I have one dataset OL
looking like that:
RLength RName
1: 154 3V1A
2: 154 TOR7
3: 154 F238
4: 154 RQ2D
5: 154 6TA2
---
27190: 56 R015
27191: 56 OTM2
27192: 56 36BY
27193: 56 BOMI
27194: 56 C5LZ
(The size varies from 30-170 randomly)
and I have my main data XKEY
looking like:
RLength RName
1: 31 9NHI
2: 31 QEYA
3: 31 VR9K
4: 31 TZSO
5: 31 VUM8
---
1472803: 74 SF7I
1472804: 74 THAV
1472805: 74 UKWK
1472806: 74 OGIS
1472807: 74 SCJX
(Those are different RName with size in the same range)
Then I want to take a random subset of value in XKEY
corresponding to the Length of OL
. For example, if have 196 RName with a length of 154 in OL
: I want to pick a random subset of rows (no duplicates) in XKey
with a length of 154 (Knowing that there is 100% of time the required amount in XKey).
How can I do that in one loop without asking too much memory ? I wanted to go through a for each loop but that would probably be not efficient and there is probably a function that ?
Thanks a lot,
Cheers
Aucun commentaire:
Enregistrer un commentaire