2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rで連続変数からサンプリングした値を階級ごとに集計したい時

Last updated at Posted at 2012-03-16

結果は一例です。

> Z <- stats::rnorm(10000)
> table(cut(Z, breaks = -6:6))

(-6,-5] (-5,-4] (-4,-3] (-3,-2] (-2,-1]  (-1,0]   (0,1]   (1,2]   (2,3]   (3,4]   (4,5] 
      0       0      12     211    1371    3474    3346    1368     207      11       0 
  (5,6] 
      0 
> as.integer(table(cut(Z, breaks = -6:6)))
 [1]    0    0    8  210 1395 3433 3353 1391  197   12    1    0
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?