Trying to teach myself R. Using problem from a friend which requires me to:

* Construct a matrix with 5000 rows and 20 columns
* Each column represents toss from coin #1 to #20
* Each column must represent 50 coin tosses.
* Probability goes from .05 to 1 of getting heads from coin 1 in column 1 to coin 20 in column 20

I'm not quite sure how to loop this or the most efficient way to go about it. Do I need to go up by .05 increments? 

* Find the mean and the variance of each column and
hold the results in a 20\*2 matrix.

-Put the first 8 columns into histograms using 2\*4 matrix

-Have each main title be the coin #.

Here's the code I have so far. I think I'm on the right track in some areas. Any help is appreciated. Thanks

```
test<-matrix(nrow=5000,ncol=20)
for(i in 1:20){

test<-matrix(nrow=5000,ncol=20,data=
c(rbinom(n=5000, size=50, prob=.05),rbinom(n=5000, size=50, prob=.10)
} ??

testdescstats<-matrix(nrow=20,ncol=2)
for(i in 1:20){

testdescstats[i,1]<-mean(test[,i])
testdescstats[i,2]<-var(test[,i])
}

split.screen(c(2,4))
for(i in 1:8){
screen(i)
hist(test[,i],paste0 graph titles?
}

```