Re: [R] lookup not working properly

2011-04-12 Thread Dimitri Liakhovitski
Thank you, Sarah. This seems to be working: a=c("ba ba","ca ca","da da", "lake lake, a", "lake lake, b","lake of","lama ca, a","lama ca, b","ma ma") b=c("ba ba","ca ca","OTHER", "lake lake, a", "lake lake, b","lake of","lama ca, a","lama ca, b","OTHER") myref<-data.frame(a=a, b=b) myref$a<-as.chara

Re: [R] lookup not working properly

2011-04-12 Thread Sarah Goslee
Dimitri, It isn't clear to me exactly what you are trying to do, but this might be closer. Note the stringsAsFactors argument I added to data.frame: I don't think you are likely to want factors for this application. Also, it's a bad idea to create a variable named c since that is the name of a fun

[R] lookup not working properly

2011-04-12 Thread Dimitri Liakhovitski
Hello! Below is my exmample. "myref" is my reference data frame with columns a and b. "temp" is my data with column c analogous to column a in "myref". I am trying to create a new variable b - in "temp" - that matches values from b in "myref" to values in c. If you look at the resulting data frame