剪切功能:在R中不规则地剪切 [英] Cut Function: Making Irregular cuts in R
本文介绍了剪切功能:在R中不规则地剪切的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用cut函数将不规则的中断划分为不规则的中断。
I need to use the cut function to divide into irregular, uneven breaks.
我需要将剪切范围划分为1至15、16至19、20至45 ...等虽然我不知道该怎么做或是否可能。
I need to cut into ranges such as 1 to 15, 16 to 19, 20 to 45... ect. Though I do not know how to do this or if it is possible. Please help!
推荐答案
?cut
是很好的第一步。 。
?cut
is a good first step...
以下是您可以构建的示例:
Here is a sample from which you can build:
# create a long vector that you want to cut
z <- rnorm(10000)
# create a vector with irregular breakpoints
breaks <- c( -6, -1, 1, 3, 6 )
# cut the long vector, look at the `table()`d result
table( cut( z, breaks ) )
(-6,-1] (-1,1] (1,3] (3,6]
1572 6806 1608 14
这篇关于剪切功能:在R中不规则地剪切的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文