Skip to content
Prev 86246 / 398528 Next

how do I "relate" tables in R?

Dear Jeff,

Assuming that the column named "z" in the matrix data2 already exists and
has arbitrary content (such as 0's or NA's), how about the following?

data2[,"z"] <- data1[data2[,"ID"], "z"]

I hope this helps,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
--------------------------------