Since you got the most suitable way to get x, why can't you get the
variances in the same way? Just like:
  v = vector()
  for (i in 1:length(x)) v[i] = var(x[[i]])

BTW, it is much better to use lapply, like this:
  lapply(x, var)

On Thu, May 14, 2009 at 8:26 PM, Debbie Zhang <debbie0...@hotmail.com> wrote:
>
> Thanks for everyone.
>
>
>
> I think the approach below is most suitable for me, as a beginner.
>
> x=list()
>> > for(i in 1:n){
>> > x[[i]]=rnorm(i,0,1)
>> > }
>
>
>
> Now, I am trying to obtain the sample variance (S^2) of the 1000 samples that 
> I have generated before.
>
> I am wondering what command I should use in order to get the sample variance 
> for all the 1000 samples.
>
>
>
> What I am capable of doing now is just typing in
>
> var(z[[1]])
>
> var(z[[2]]).....................
>
>
>
> Thanks for help.
>
>
>
> Debbie
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to