[R] resampling from matrix using multivariate probabilities

Ingolf Kuehn kuehn at halle.ufz.de
Mon Sep 30 11:32:53 CEST 2002


Dear R-users,

I am an newbie to R and would like to do an ordinary resampling (like provided by the 
function "sample") but from a matrix instead of a vector and  with a probability 
provided by another matrix.

The first matrix contains several environmental conditions sampled at several 
locations:
location	cond1	cond2	cond3	cond4	...
A		10	5	8	3
B		2	4	2	5
C		6	2	7	3
D		9	4	5	2
E		15	8	3	5
...

The other matrix has the same format but providing probabilities (derived from a 
subset of the matrix). I would like to resample the matrix row-wise with the probabilty 
provided for each "cell" by the second matrix.

I cannot do it colum-wise as this would just recognize the probability for one condition 
per location and not all conditions per location at once.

Any suggestion is appreciated!

Many thanks

Ingolf 

================================================
Dr. Ingolf Kuehn
UFZ - Umweltforschungszentrum Leipzig-Halle GmbH
- Sektion Biozoenoseforschung -
UFZ - Centre for Environmental Research
- Department of Community Ecology -
Theodor-Lieser-Strasse 4
06120 Halle
Germany
Tel (+49)345 / 558 5311
Fax (+49)345 / 558 5329
email: kuehn at halle.ufz.de
http://www.ufz.de/spb/bioz/

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list