Rサンプル (ggplot2)
r01 <- function(suretu = 1:6){ saikoro <- sample(suretu,size = 2, replace = TRUE) sum(saikoro) } library(ggplot2) r01() d01 <- replicate(10000,r01()) qplot(d01,binwidth = 1)
サイコロを2回ふる関数 r01
10,000回実行してヒストグラムを作成
x <-seq(-1, 1, length=10) y <- x^3 qplot (x,y)