[R] SPSS command "match files" for merging one-to-many (hierarchical) equivalent in R?

Marc Schwartz marc_schwartz at me.com
Mon Mar 9 19:58:25 CET 2015

> On Mar 9, 2015, at 1:53 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> On 09/03/2015 1:40 PM, Kristina Loderer wrote:
>> Dear R community,
>> to combine data sets of hierarchical, nested nature (i.e., data sets
>> linked by, for example, the variable "study ID" and then also by
>> "outcome_variable_1" and "outcome_variable_2") I can use the match files
>> command in SPSS. What is the equivalent command / function in R? Is it
>> the merge function, or the match function? The more I read, the more
>> confused I become..
> I don't know SPSS at all, so I can't help you.  If nobody else does, you might try putting together a tiny example in R showing what you're starting with, and what you want to produce.  From what you wrote, I'd guess merge(), not match(), but you might really be asking for something completely different.
> Duncan Murdoch

Based upon the info here:


I would go with ?merge, since the desired functionality appears to be a relational join operation.


Marc Schwartz

More information about the R-help mailing list