Hi all,
 
I'm new to the list...pretty new at learning to code in R...
 
Is there a way to relate 2 different arrays in R?
 
Hypothetical example:
 
data1
ID    z
1    100
2    250
3    75
4    12
5    89
 
data2
ID    z
1
1
1
1
2
3
4
3
4
5
5
5
etc.
 
Goal is to fill column z in data2 with appropriate z-values from data1 that
correspond to a given ID.
 
I'm looking for something akin to a relational database, or a lookup table
in Excel.
 
I can construct a simple for-loop (with if else statement) to fill the
z-column in data2, but in my case data2 is 150,000 records long, so this
approach is not efficient.
 
Thanks for any help
Jeff
 
******************************************
Jeffrey Moore, Ph.D.
Postdoctoral Research Scientist
Duke Center for Marine Conservation
Duke University Marine Laboratory
135 Duke Marine Lab Road
Beaufort, NC 28516
Phone: (252) 504-7653
Fax: (252) 504-7689
Email: jemoore@duke.edu
*****************************************
 

	[[alternative HTML version deleted]]


