rm(list=ls()) #clears memory setwd("/rstuff") #sets path x <- 1:5000 #number of iterations for "for" serr <- NULL smean <- NULL#creates a null set for(i in seq(along=x)) {serr <- c(serr, (sd(rnorm(n=50, mean=10, sd=2))/sqrt(50)))} #calculates the sample standard errors from random draws of 50 observations from a #normal statistical population with a population mean of 10, and a standard deviaiton of 2 for(i in seq(along=x)) {smean <- c(smean, mean(rnorm(n=50, mean=10, sd=2)))} #calculates sample means from random draws of 50 observations from a #normal statistical population with a population mean of 10, and a standard deviaiton of 2 sterr <- cbind(serr,smean) write.csv(sterr, file = "sterr.csv")