Re: [R] biasing conditional sample

2012-11-11 Thread dms
ate Professor of Anthropology > Texas A&M University > College Station, TX 77843-4352 > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of Rui Barradas >> Sent: Sunday, November 11, 201

Re: [R] biasing conditional sample

2012-11-11 Thread David L Carlson
PM > To: d...@riseup.net > Cc: r-help@r-project.org > Subject: Re: [R] biasing conditional sample > > Hello, > > The function that follows returns a matrix, not a data.frame but does > what you ask for. > > > fun <- function(x, y, n){ > f <- f

Re: [R] biasing conditional sample

2012-11-11 Thread arun
2 7 1  8 9 10 #15 15 1 9  8 4  7 #16 16 6 1  3 7 10 A.K. - Original Message - From: "d...@riseup.net" To: r-help@r-project.org Cc: Sent: Sunday, November 11, 2012 2:06 PM Subject: [R] biasing conditional sample Hi all, I'm looking for some help to bias the sample func

Re: [R] biasing conditional sample

2012-11-11 Thread Rui Barradas
Hello, The function that follows returns a matrix, not a data.frame but does what you ask for. fun <- function(x, y, n){ f <- function(x, y){ while(TRUE){ rnd <- sample(x, 1) if(!any(rnd %in% y)) break } rnd } for(i in seq_len(n)){

[R] biasing conditional sample

2012-11-11 Thread dms
Hi all, I'm looking for some help to bias the sample function. Basically, I'd like to generate a data frame where the first column is completely random, the second, however, is conditional do the first, the third is conditional to the first and the second and so on. By conditional I mean that I sh