本文介绍了如何随机化向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用一个简单的单行命令随机地将向量中的数字顺序重新组织吗?
I would like to randomly reorganize the order of the numbers in a vector, in a simple one-line command?
我的特定向量V从1到10的每个值都有150个条目:
My particular vector V has 150 entries for each value from 1 to 10:
V <- rep(1:10, each=150)
推荐答案
是.
sample(V)
来自?sample
:
这篇关于如何随机化向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!