I'm trying to fill in missing data in data frames.
I've got two data frames, however each one includes information that is missing in the other one. They look something like this, where the x are numbers:
DATA FRAME 1 DATA FRAME 2
Headword Spelling Freq Headword Spelling Freq
Word1 Sp1a x Word1 Sp1a x
Word1 Sp1b x Word1 Sp1c x
Word1 Sp1d x Word2 Sp2a x
Word2 Sp2a x Word2 Sp2b x etc
So, DF1 has spellings 1a, 1b, and 1d for Word 1. DF2 has spellings 1a and 1c for Word1. However, DF1 has only spelling 2a for Word2, but DF2 has spellings 2a and 2b for Word2.
What I need is for both data frames to include all the spellings, even if they're not present in that data. So where Sp1c is missing in data frame 1, I'd like it to be there and the frequency = 0.
So I'd like it to look like this:
DATA FRAME 1 DATA FRAME 2
Headword Spelling Freq Headword Spelling Freq
Word1 Sp1a x Word1 Sp1a x
Word1 Sp1b x Word1 Sp1b 0
Word1 Sp1c 0 Word1 Sp1c x
Word1 Sp1d x Word1 Sp1d 0
Word2 Sp2a x Word2 Sp2a x
Word2 Sp2b 0 Word2 Sp2b x
I think I need to use more than one join and combine them together to make this work but I'm not sure how.
How do I add any missing values from data frame 2 to the headword and spelling columns in data frame 1, and then set the frequency to be 0? (And vice versa to add missing values to data frame 1.)