[R] Isolating Distinct Dates between two data frames

Ogbos Okike g||ted|||e2014 @end|ng |rom gm@||@com
Mon Mar 2 04:58:41 CET 2020


Dear Sarah,
Thank you for your contribution.

I have tried to use merge function as suggested. But the function
seems to work with data frame. And the file cannot be in the form of
data frame as they have different lengths. I also tried whether I can
use the function without data frame. It didn't work either.

I have used dput function to send all the data.

Please take a second look and see if there is a better way to go.

Thank you.
Best regards
Ogbos

On Sun, Mar 1, 2020 at 10:27 PM Sarah Goslee <sarah.goslee using gmail.com> wrote:
>
> Look at the all arguments to merge() - you can keep the non-matching
> dates, and look for NA values in the data.
>
> Sarah
>
> On Sun, Mar 1, 2020 at 4:12 PM Ogbos Okike <giftedlife2014 using gmail.com> wrote:
> >
> > Dear Friends,
> > I have two data frame of the form:
> > 1997-11-2219 -2.54910135429339
> > 1997-11-2222 -2.66865640466636
> > 1997-11-2305 -2.60761691358946
> > 1997-12-1104 -2.5323738405159
> > 1997-12-1106 -2.6020470080341
> > 1998-05-0204 -4.49745020062937
> > 1998-05-0209 -4.9462725263541
> > 1998-05-0213 -4.60533021405541
> > 1998-05-0218 -4.24415210827579
> > 1998-05-0220 -4.04368079911755
> > 1998-05-0222 -4.05320945184028
> > 1998-05-0302 -4.97226664313875
> > 1998-05-0307 -3.59108791877756
> > 1998-05-0310 -4.06038057061717
> > 1998-05-0313 -4.25967313751507
> > 1998-05-0316 -3.51896561964782
> > 1998-05-0318 -3.43849389406503
> > 1998-05-0321 -2.85778623531446
> > 1998-05-0323 -2.75731441597261
> > 1998-05-0401 -2.85684255921844
> > 1998-05-0403 -2.69637066510405
> > 1998-05-0408 -4.47519076670884
> > 1998-05-0411 -4.2644827160855
> > 1998-05-0414 -4.20377458198688
> > 1998-05-0417 -4.27306636458818
> > 1998-05-0420 -4.05235806406442
> > 1998-05-0500 -4.19141353436269
> > 1998-05-0506 -4.23999646421515
> > 1998-05-0510 -3.95905156765632
> > 1998-05-0512 -3.63857906459363
> >
> > and
> > 1997-11-2221 -2.04916867404692
> > 1997-11-2303 -1.7285761175751
> > 1998-04-3010 -1.51968127380408
> > 1998-04-3016 -1.51845077174125
> > 1998-05-0101 -1.91660416876407
> > 1998-05-0104 -2.11598840871961
> > 1998-05-0107 -1.99537253619755
> > 1998-05-0109 -1.81496189214167
> > 1998-05-0112 -1.7343458326657
> > 1998-05-0114 -1.77393506418581
> > 1998-05-0121 -1.57249698394961
> > 1998-05-0204 -3.64105829839415
> > 1998-05-0207 -3.5504415342881
> > 1998-05-0209 -3.71003029685917
> > 1998-05-0213 -3.31920767504605
> > 1998-05-0219 -3.98797337595274
> > 1998-05-0300 -3.17694445869443
> > 1998-05-0304 -3.09612110658432
> > 1998-05-0306 -3.29570935794719
> > 1998-05-0308 -3.24529756101203
> > 1998-05-0310 -3.20488571584633
> > 1998-05-0312 -3.16447382251761
> > 1998-05-0314 -2.86406188109331
> > 1998-05-0319 -2.5430318175571
> > 1998-05-0321 -2.87261970832946
> > 1998-05-0400 -2.55200145489882
> > 1998-05-0407 -3.27055844665711
> > 1998-05-0409 -3.24014605168738
> > 1998-05-0412 -3.29952737040137
> > 1998-05-0414 -3.44911485708791
> >
> > Some dates are common among the two.
> >
> > I use few  lines of code to select the common dates:
> > setwd("./")
> >  list1<-read.table("THUL1",col.names=c("V1","V2"))
> >  list2<-read.table("INVK1",col.names=c("V1","V2"))
> >  B<-merge(list1,list2, by ="V1")
> >
> > Now, I wish to do something differently. I want to identify the dates that
> > are in THUL1 but are not in INVK1 or vise versa, that is to identify
> > uncommon dates among the two lists.
> >
> > Could you please assist me to achieve it.
> >
> > Thank you.
> > Best regards
> > Ogbos
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Sarah Goslee (she/her)
> http://www.sarahgoslee.com



More information about the R-help mailing list