I have below-mentioned data frame in R:
ID Unique_Id Date Status I-1 UR-112 2020-01-01 14:15:16 Approved I-2 UR-112 2020-02-12 14:15:16 In Process I-3 UR-112 2020-03-23 14:15:16 In Process I-4 UR-113 2020-01-01 14:15:16 Hold I-5 UR-113 2020-04-11 14:15:16 Hold I-6 UR-114 2020-04-07 14:15:16 Approved I-7 UR-114 2020-05-08 14:15:16 Approved I-8 UR-114 2020-05-09 14:15:16 In Process I-9 UR-115 2020-01-18 14:15:16 Approved I-10 UR-115 2020-03-23 14:15:16 Approved I-11 UR-116 2020-02-11 14:15:16 Approved I need to create a sub set of random 3 Unique_Id which is spread across all Date and these three Unique_Id must come under the available Status.
Required Output <-
ID Unique_Id Date Status I-1 UR-112 2020-01-01 14:15:16 Approved I-2 UR-112 2020-02-12 14:15:16 In Process I-3 UR-112 2020-03-23 14:15:16 In Process I-4 UR-113 2020-01-01 14:15:16 Hold I-5 UR-113 2020-04-11 14:15:16 Hold I-11 UR-116 2020-02-11 14:15:16 Approved
x[x$x$Unique_Id %in% sample(unique(x$Unique_Id), 3),]Statuspart.Status?Statusand you are limited to three randomUnique_Ids and need each possible value of status to be represented at least once, then the only possible option is to select oneUnique_Idfor each value ofStatus. If there are more than three possible values ofStatus, then there is no solution. Or am I missing something?