[R] Extracting a subset from a dataframe

Augusto.Sanabria at ga.gov.au Augusto.Sanabria at ga.gov.au
Fri Feb 23 07:26:00 CET 2007


Good day everyone,

Can anyone suggest an effective method to solve
the following problem:

I have 2 dataframes D1 and D2 as follows:

D1:
        dates       ws   wc pwc
 2005-10-19:12:00  10.8  80  81
 2005-10-20:12:00  12.3   5  15
 2005-10-21:15:00  12.3   3  15
 2005-10-22:15:00  11.3  13  95
 2005-10-23:12:00  12.3  13   2
 2005-10-24:15:00  10.3   2  95
 2005-10-25:15:00  10.3   2   2

D2:
        dates       ws   wc  pwc
 2005-02-02:15:00  17.5   5  96
 2005-02-19:15:00  20.1  15  97
 2005-02-20:18:00  16.5  95  95
 2005-03-03:18:00  10.3  95  95
 2005-03-04:00:00  13.4  13  95
 2005-10-22:15:00  11.3  13  95
 2005-10-25:15:00  10.3   2   2

I want to create another dataframe made up
of the values of dataframe1 which are not common
with dataframe2, ie. newD = D1 - (D1 intersection D2)

that is,
newD: 
       dates        ws   wc  pwc
 2005-10-19:12:00  10.8  80  81
 2005-10-20:12:00  12.3   5  15
 2005-10-21:15:00  12.3   3  15
 2005-10-23:12:00  12.3  13   2
 2005-10-24:15:00  10.3   2  95
 
Thanks for any help you can provide,

Augusto

--------------------------------------------
Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial & Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av. & Hindmarsh Dr.
Symonston ACT 2601
Ph. (02) 6249-9155



More information about the R-help mailing list