search for: create_bin_string

Displaying 1 result from an estimated 1 matches for "create_bin_string".

2008 Jun 11
3
searching for specific row in matrix
...ried variations of "which", and a for loop comparing pop[i,] to target without much success, nor did google yield any results. I am hoping someone here can provide a suggestion. Thanks, EB --------------------------------------------- # Here is the code that generates the above data create_bin_string <- function(len) { sample(0:1, len, replace=T) } ROWS = 10 COLS = 5 pop = matrix(create_bin_string(ROWS*COLS), ROWS, COLS, byrow=T) target=c(1, 1, 0, 1, 1) # my population print(pop) # I am looking for the index of this in pop # if present (else -1?) cat("\ntarget: ", target,...