サイコロを投げて、その出た目の数をヒストグラムに描くプログラムの例です。

#サイコロ(基本)
roll03 <- function(throw = 100){
  x <- sample(1:6, size = throw, replace=TRUE)
  hist(x, breaks=seq(0, 6, 1))   
}

roll03(1000)

#表題を付ける(main="Dice)
roll3 <- function(throw = 100){
  x <- sample(1:6, size = throw, replace=TRUE)
  hist(x, breaks=seq(0, 6, 1), main="Dice")   
}

roll3(2000)

#英語では面白くないので、日本語にする
roll3 <- function(throw = 100){
  quartzFonts(HiraKaku=quartzFont(rep("HiraKakuPro-W3", 4)))
  x <- sample(1:6, size = throw, replace=TRUE)
  hist(x, breaks=seq(0, 6, 1), col = 'skyblue', border ='white', main="さいころの出た目", family="HiraKaku")   
}

roll3(3000)