Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想选择一个向量的随机值并打印它们,而不可能再次出现相同的数字。例如,如果 32 已经被打印出来,那么应该不能再次打印这个数字(或将这个数字保存在另一个变量中)。我怎样才能做到这一点?
test <- c(1,32,4,92,20) for (i in 1:4){ print(sample(test,size = 1))}