In this post, we will see how to resolve Align dataframes in R
Question:
I have multiple Excel sheets of a dataset that I need to align.
Simplifying, it looks like this (this is just a simplification, in fact it has hundreds of columns and rows and there are multiple sheets of data):

As you can see, in the first sheet every patient has age, however in sheet n° 2 only patients 1, 3 and 4 have data on sex (and also those with sex missing are not present in the sheet). The result I want to have is in the third image so that the patients with sex missing are still reported but with blank. So I want to perform the alignment based on PATIENT NUMBER.
I want to know if there are packages or rapid ways to do it.
Best Answer:
Merge them with a left join:
Created on 2023-03-09 with reprex v2.0.2
If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com