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]]
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 at 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 at 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
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 at 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 at 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.
Hi Ogbos, One way to get all combinations of common and different dates is: THULinINVK<-which(THUL1$V1 %in% INVK1$V1) THULnotinINVK<-which(!(THUL1$V1 %in% INVK1$V1)) INVKinTHUL<-which(INVK1$V1 %in% THUL1$V1) INVKnotinTHUL<-which(!(INVK1$V1 %in% THUL1$V1)) This produces vectors of indices that can be used in further calculations. Jim On Mon, Mar 2, 2020 at 8:12 AM Ogbos Okike <giftedlife2014 at 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 at 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.
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 at 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 at 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 at 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.
Dear Jim, Many thanks for sparing your time to assist me. I have tried your codes. It worked very well to some extent for me. At least it produced the indices you mentioned. But I got stuck when I think of how to use it in further calculations as you indicated. I tried including the indices as the first column of the data. I did the same for each of the station data. That is including the length (example 1:1609) as the first column. But that brought me back to the original problem as I had no means of isolating the uncommon dates using the common dates selected for the two stations. I guess that you can point me further to the right direction to use the indices to discriminate between common dates and uncommon dates and their associated V2 (Forbush events). Warm regards Ogbos On Sun, Mar 1, 2020 at 10:49 PM Jim Lemon <drjimlemon at gmail.com> wrote:> > Hi Ogbos, > One way to get all combinations of common and different dates is: > > THULinINVK<-which(THUL1$V1 %in% INVK1$V1) > THULnotinINVK<-which(!(THUL1$V1 %in% INVK1$V1)) > INVKinTHUL<-which(INVK1$V1 %in% THUL1$V1) > INVKnotinTHUL<-which(!(INVK1$V1 %in% THUL1$V1)) > > This produces vectors of indices that can be used in further calculations. > > Jim > > On Mon, Mar 2, 2020 at 8:12 AM Ogbos Okike <giftedlife2014 at 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 at 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.
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 at 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 at 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 at 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