[R] Problems with sample variance

Chloe Smith
Thu, 21 May 2009 00:32:34 -0000

Dear R users,

I am a beginner to R. I generated 1000 samples with 15 data in each sample

I tried finding the variance for each sample

I used the code:

m=1000;n=15
> r<-rnorm(15000)
> for(i in 1:m){
x=data[,i]
v=var(x)}

what I got was just the variance for the last sample i.e. the 1000th sample

but what I want is 1000 variance.

Does anyone know what I did wrong?

Thanks

Chloe Smith

--
View this message in context:
http://www.nabble.com/Problems-with-sample-variance-tp23645919p23645919.html
Sent from the R help mailing list archive at Nabble.com.