help recoding
hi R-listers, I would like some help recoding a variable. I have a dataframe 'cause' that translates between a set of codes: acc nds - - 1 2 3 4 5 8 ... ... the desired result for dataframe 'p': a - 1 5 5 would be: a b - - 1 2 5 8 5 9 I have tried: transform(p, b=cause$nds[cause$acc==p$a]) but for some reason it complains about the difference in length between the translation and result dataframes. This prints the desired result, but I am unsure how to collect the results into a variable. for (i in p) print cause$nds[cause$acc==i] Any help greatly appreciated. Selwyn