0
0

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 > table() + barplot() > diceの出目をbarplot表示

Last updated at Posted at 2016-09-21
動作確認
RStudio 0.99.903 on Windows 7 pro
R version 3.3.1 

参考 Rで学ぶデータ・プログラミング入門 by 石田基広さん

3までのdiceを考えて実装してみた。

> dice<-sample(1:3, 100, rep=T, prob=c(1/6,1/6,1/6))
> table(dice)
dice
 1  2  3 
33 33 34 
> z<-table(dice)
> barplot(z)

qiita.png

確率は1/6でなく1/3が実は正しい。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?