Trying to write R function, binomial distribution


I am looking for some help with an Intro to R homework from a professor who doesn't clearly explain the things we need to know for the homework in class...:shakehead:confused:

I'm trying to figure out how to write a function to simulate the sampling distribution of the mean when the population has a binomial distribution. The function should have the following form:

centralLimit = function(nreps, nobs, trials, ps, hist=FALSE, qqnorm=FALSE, ...)

My already written code defining the variables is here:

# number of samples
nreps = 10000
# number of observations in each sample
nobs = 100
# number of trials in each observation
trials = 5
# probability of "success" in each trial
ps = .1

# generate data
binomSamps = lapply(rep(nobs,nreps), rbinom, size=trials, prob=ps)

# compute sample means
mymeans = sapply(binomSamps, mean)

Any help would be much appreciated!! :)
Any thoughts??

The follow-up to this is using the written CentralLimit function (from above) with nobs of 5, 10, 50, 100 and 500 and to plot all of the histograms and Q-Q plots
1. What is your question, exactly?
2. Typically, most of the forum users do not like to do student's homework. However, you are invited, to condense your problem into a core part, which solution you do not know, as most forum user do with their (job related) R programming problems.
3. Reposting may make other people misleading think your problem has been solved already.