Re: [R] matching lists

2009-04-14 Thread baptiste auguie
Try this, numbers <- c("one","two","three","four") values <- c(10,20,30,40) v <- list(sample(numbers,3),sample(numbers,2)) v sapply(v,function(.l) values[match(.l, numbers)] ) HTH, baptiste On 14 Apr 2009, at 13:01, Manoel Silva wrote: Dear All, Here's my problem. I have two lists: v [[

[R] matching lists

2009-04-14 Thread Manoel Silva
Dear All,   Here's my problem. I have two lists:   > v [[1]] [1] "five" [[2]] [1] "four" [[3]] [1] "three" [[4]] [1] "two" [[5]] [1] "one" [[6]] [1] "six" [[7]] [1] "five"  "four"  "three" "two"   "one"   "six"  [[8]] [1] "four"  "three" "two"   "one"   "six"  [[9]] [1] "three" "two"   "one"   "s