[R] selecting from a series of integers withpre-determined probabilities

Bert Gunter gunter.berton at gene.com
Mon Sep 22 00:33:56 CEST 2008


?sample.

-- Bert Gunter

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of John Sorkin
Sent: Saturday, September 20, 2008 12:43 PM
To: r-help at r-project.org
Subject: [R] selecting from a series of integers withpre-determined
probabilities

R 2.6
Windows XP

I need to select from the integers 1,2,3,4,5 with some pre-determined
probability, e.g. probability of selecting 5 80%, probability of selecting 1
or  2 or  3 or 4 20%. Any suggestions for how I might accomplish this? I
need to do it very efficiently as I will be doing it 500,000 times.
Thanks
John

John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:8}}



More information about the R-help mailing list