Hi all,
I am looking for a way to get random samples based on the grouping.
See example below:
1) Randomly select 2 samples from the ones start with "A" under Group
2) Randomly select 3 samples from the ones start with "B" or "C" under Group
If the population is less than the sample size, then the whole population would be selected as in "B" group.
Data:
Group | Text1 | Text2 |
A101 | A1 | A1 |
B101 | B1 | B1 |
A102 | A1 | A2 |
C103 | C1 | C3 |
C102 | C1 | C2 |
C101 | C1 | C1 |
A204 | A2 | A4 |
A102 | A1 | A2 |
B301 | B3 | B1 |
Desired outcome:
Group | Text1 | |
Sample A | A101 | A1 |
A102 | A1 | |
Sample C | C103 | C1 |
C102 | C1 | |
C101 | C1 | |
Sample B | B101 | B1 |
B301 | B3 |
Thank you in advance for your help