Selection in Rstudio



DATAFRAME <- data.frame(i = c(sample(1:30000)),
P = c(sample(LETTERS[1:21], 10, replace = T)),
D = as.Date("31/05/2021", format="%d/%m/%Y"),
e = c(sample(c("a","b","c"),size=100,replace = T,prob=c(0.6,0.3,0.1))),
C= c(sample(LETTERS[1:21], 10, replace = T)),
k = c(sample(1:120)),
F =c(sample(1:5)),
o = c(sample(1:30000)),
t = c(sample(1:30000)),
t = c(sample(1:30000)),
L = c(sample(LETTERS[1:21], 10, replace = T))) %>%
mutate(S= paste(one, two, three, sep = ""))


You can replace the numbers, large the DF of the code if it is necessary.

Thank you

What is the rule behind the recommendation? If there is no rule at all, you can just output 12 per ID with a data.table:

dt <-
dt[dt[, .I[1:12], id]$V1][, .(id, SKU)]
1 Like


Thank you very much

Thanks a lot if you can help me with more alternatives.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.