Re: [R] Randomly generating data

2011-03-21 Thread Dennis Murphy
Hi: It's unclear what you want for your vector of probabilities, but here's one approach: u$p <- runif(1000)# generate a random vector of success probabilities samp <- function(x) { p <- as.numeric(x[3]) # x will be character as constructed, pick out the numeric value of p

[R] Randomly generating data

2011-03-21 Thread Lisa
Hi, everybody, I have a problem and need your help. There are two columns that look like this: [1,] "t" "f" [2,] "f" "t" [3,] "t" "f" [4,] "t" "t" [5,] "f" "f" I just want to generate the third column based on these two columns. First, I randomly choose one of the two columns, sa