I am using tapply() to apply a function to my data
Myrepfun <- function(x,n){
nstudents <- replicate(1000,sum(sample(x, size=n,replace=TRUE)))
quantile(nstudents,probs=0.95)
}
tapply(weight,schoolcode,Myrepfun,n=2)
I would like to use this within a for loop and print out the output. I have tried the following and I get the error message: Error: unexpected symbol in "for(n in 12:13) (t=tapply(ow,sc,ndropfunction,n,p=0.95) output
for(n in 1:25) {t=tapply(weight,schoolcode,Myrepfun,n,p=0.95) print(c=(t,n))}