Here is one way of doing it by removing the element from the vector > # exclude the 3rd element of the vector > sample((1:10)[-3], 10, TRUE) [1] 4 5 7 10 2 10 10 7 7 1 >
On Mon, Jul 21, 2008 at 5:10 AM, Juliane Struve <[EMAIL PROTECTED]> wrote: > Dear list, > > > I am trying to sample from a list of integers 1:10, but need to exclude one > of them. The one to be excluded is a variable called "number" and can take > values 1:10. The line below does not work, but shows what I am trying to do. > Would somebody be able to help me with the syntax ? > > anglenumber=sample(1:10, exclude = "number",size=1,replace=TRUE) > > Thank you very much for a hint. > > Regards, > > Juliane > > > Dr. Juliane Struve > Environmental Scientist > 10, Lynwood Crescent > Sunningdale SL5 0BL > 01344 620811 > > > __________________________________________________________ > Not happy with your email address?. > Get the one you really want - millions of new email addresses available now > at Yahoo! http://uk.docs.yahoo.com/ymail/new.html > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? ______________________________________________ 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.