Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R有效地计数频率_R - Fatal编程技术网

R有效地计数频率

R有效地计数频率,r,R,假设我有一个问题,我有一个向量,叫做,基,定义为 bases <- c(1:100000) bases本质上,您是在寻找直方图。使用hist功能 bases <- c(1:100000) instances <- c(12, 367, 442, 551, 1882, 2556, 13222, 13772, 18999, 26000, 29004, 83027) # plot = 0 prevents plotting # breaks ar

假设我有一个问题,我有一个向量,叫做,基,定义为

bases <- c(1:100000)

bases本质上,您是在寻找直方图。使用
hist
功能

bases <- c(1:100000)
instances <- c(12, 367, 442, 551, 1882, 2556, 13222, 13772, 
               18999, 26000, 29004, 83027)

# plot = 0 prevents plotting 
# breaks are the values at which we want to split our interval 
h <- hist(instances, breaks = seq(0, max(bases), 1000), plot=0) 

base查看
findInterval
cut
…可能还有
table
tablate
。我认为这是最有效和明智的方法,因为我计划稍后绘制直方图:)
bases <- c(1:100000)
instances <- c(12, 367, 442, 551, 1882, 2556, 13222, 13772, 
               18999, 26000, 29004, 83027)

# plot = 0 prevents plotting 
# breaks are the values at which we want to split our interval 
h <- hist(instances, breaks = seq(0, max(bases), 1000), plot=0)