Re: [R] r-help

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Sun 26 Jun 2005 - 01:02:43 EST

Sotdikov Mansor wrote:

> There is a function 'simMD()' in 'popgen' library which

"package", not "library".

> simulates a sample of genotype data as follows:
>

>>library(popgen)
>>x <- simMD(20, 2, 2, p = NULL, c(0.09, 0.05), ac = 2, beta = 1)
>>x

>
> , , 1
>
> [,1] [,2]
> [1,] 1 1
> [2,] 1 1
> ...
> [37,] 1 2
> [38,] 2 2
> [39,] 2 2
> [40,] 2 2
>
> , , 2
>
> [,1] [,2]
> [1,] 2 2
> [2,] 1 2
> [3,] 1 2
> ...
> [38,] 2 1
> [39,] 1 2
> [40,] 1 2
>
> How can I repeat this function, for example, 1000 times to generate 1000
> samples and assign each output to distinct 'vector' Xi, where i=1,2,...,1000

The above does not look like a vector (even if internally represented as such).

> The goal is to generate a large number of samples using this function and
> then use them in further analysis.

I'd write them into a list by
replicate(1000, YourCall)

If you really want objects X1, ..., Xn, you should read the FAQ and ?assign.

Uwe Ligges

> Any suggestions would be appreciated
> Sitdikov Mansor
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Jun 26 01:09:03 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:02 EST