如何使用切割r划分向量?
我听说我应该使用r中的剪切功能将数据分为相等的部分,但是它似乎并不像
which(cut(1:1000,3)==1)
我当前的解决方案那样容易,
t<-cut(1:1000,3)
which(match(t,levels(t))==1)
我认为这是最好的解决方案。
I heard I'm supposed to use the cut function in R to divide data into equal parts, but it doesn't seem to be as easy as
which(cut(1:1000,3)==1)
My current solution is
t<-cut(1:1000,3)
which(match(t,levels(t))==1)
I don't believe this to be the best solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将为您提供三个组的列表,每个组具有1/3的顺序。然后,您将使用
t [1]
来获取第一组。will give you a list with three groups, each having 1/3 of the sequence. Then you would use
t[1]
to get the first group, for instance.