Skip to content

searching through two different texts files to find a common variable

1 message · Daniel Malter

#
You probably want to use the merge() function. 

imaginary example for data frames named "KS" and "US," where the common
identifier variable is named "ID"

merged.data<-merge(KS,US,by.x="ID",by.y="ID",all.x=F,all.y=F)

Note that this will retain only observations for which there is a common ID
in both KS and US. If you want to keep observations that do not have
corresponding ID in the other dataset, you would have to adjust the all.x
and/or the all.y argument.

HTH,
Daniel
casswilson6 wrote:
--
View this message in context: http://r.789695.n4.nabble.com/searching-through-two-different-texts-files-to-find-a-common-variable-tp3612101p3612408.html
Sent from the R help mailing list archive at Nabble.com.