[R] Isolating Distinct Dates between two data frames
Ogbos Okike
g||ted|||e2014 @end|ng |rom gm@||@com
Mon Mar 2 03:46:52 CET 2020
Dear Jeff,
I had initially set to plain text. I didn't know when it reverted to
HTML. It has been corrected. Thanks for informing me.
I have checked ?setdiff. The examples are well explained, so it was
not hard for me to use. However, it did not seem to tackle my problem.
I have two columns but it produces results of differences or
similarities using one column. Thus, I lost track of the second
column. Since I need the two columns to plot some graphs, I got a
little confused and thus, could not continue.
I have now used dput function to attach the two files.
As I mentioned in my first mail, each of the files have two columns. I
can select dates common to both using the date column. The output
looks great to me as it outputs each of the second columns in each of
the files. That helps me to do some plotting and other comparisons. I
used the simple script I indicated to achieve it. Or in case it was
garbled, here it is again:
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")
head(B)
B gives the common date as well as the data in column 2 of each files
associated with the common date.
Now, what I am trying to achieve is to use this common date as a
reference point and run a similar script like the one above
9possibly). But this time, I wish to produce the date and the
associated V2 in THUL1 or INVK1 that is not in the common date. This
common date are technically called simultaneous dates while the
non-common dates describe the globally non-simultaneous events. But
again the associated V2 are useful in each case, else, the date
information alone makes no sense.
So B gives me the common date for both cosmic ray stations and my
problem now is how to use this B to discriminate between the common
date and the unequal or nonidentical dates and their associated V2
data in each of the stations, Inuvick and Thule data.
I would be most grateful for any more help.
Best regards
Ogbos
On Sun, Mar 1, 2020 at 10:42 PM Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
>
> a) Your use of HTML is corrupting your data. Post using plain text, and use dput output instead of trying to insert tables.
>
> b) You should read about ?setdiff.
>
> On March 1, 2020 1:12:04 PM PST, 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.
>
> --
> Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list