s-news
[Top] [All Lists]

Re: Sub setting data

To: Jason.Overstreet@honeywell.com
Subject: Re: Sub setting data
From: Rolf Turner <rolf@math.unb.ca>
Date: Fri, 16 Sep 2005 17:35:57 -0300 (ADT)
Cc: s-news@lists.biostat.wustl.edu
s1 <- df1$ser.no
s2 <- df2$ser.no
ii <- match(s2,s1)
df.new <- df1[ii,]

                        cheers,

                                Rolf Turner
                                rolf@math.unb.ca

Original message:

> I have a list of several hundred observations in one data frame that
> has several dozen variables.  In a second data frame, I have a subset
> of the first data frame containing only the serial number (primary
> key) of the first data frame.  I want to build a data frame that has
> all the variables in the first data frame, but only for the
> observations that are listed in the second data frame.  Thanks in
> advance for any help.

<Prev in Thread] Current Thread [Next in Thread>