I am getting an error while trying this. I also tried installing the qcc package and sued process.capability() but I am still getting an error. Can anyone help? Here is my code:
# Arguments: samplesize: the size of the sample that each sample mean is based on.
# number_of_samples: the number of samples and thus sample means we will #generate
xbarGenerator = function(sampleSize = 30,number_of_samples = 100)
{
for(i in 1:number_of_samples)
{
theSample = sample(population,sampleSize)
xbar = mean(theSample)
xBarVec = c(xBarVec, xbar)
}
return(xBarVec)
}
xbars = xbarGenerator(30,1000)
length(xbars)
hist(xbars)
The output I am getting is below:
> xbarGenerator = function(sampleSize = 30,number_of_samples = 100)
+ {
+ for(i in 1:number_of_samples)
+ {
+ theSample = sample(population,sampleSize)
+ xbar = mean(theSample)
+ xBarVec = c(xBarVec, xbar)
+ }
+ return(xBarVec)
+ }
xbars = xbarGenerator(30,1000)
Error in xbarGenerator(30, 1000) : object 'xBarVec' not found
> length(xbars)
Error: object 'xbars' not found
> hist(xbars)
Error in hist(xbars) : object 'xbars' not found
>