GOAT debate — Federer or Nadal
A statistics-based debate
Before I begin this journey, I want to share that I am an avid tennis fan. My love for tennis quadrupled when I moved to a hostel while going to college. The hostel was divided into 2 sections — Nadal fans vs Federer fans. That was starting 2004 when the best rivalry for all times — Federer vs Nadal started blossoming. Who can forget the nerve-wracking Wimbledon finals
From then on, the debate continued — Who is better — Federer or Nadal? Today I will try to look into some stats and see if we can debunk that.

Grand Slams
To a lot of people, tennis means grand slams. Also called majors, they are the most important event in tennis, offering the most points, money, and attention. It is analogous and equally valued as world cups in football or cricket. Hence it makes sense to make this the first measure of a person’s greatness.

Federer slightly edges this one, though Nadal being a few years younger than Federer, there is a high probability Nadal will catch up with Federer on the grand slams.
ATP titles

Federer edges this one too.
Grand Slam breakdown by court

This picture very nicely represents a lot about these players. Nadal is very strong in one grand slam, while Federer is weak in one — is how I see this.
World dominance
Here I would like to see who stayed as world #1 for more weeks. This would give us an idea of the dominance of the players when they were at their peak.

Federer wins this by a big margin. Federer was at the peak of his superiority between 2004 and 2009. Out of 24 grand slams he played during this period, Federer won 14. He reached the finals 20 times. Around this period, he won 5 straight Wimbledon and 5 straight US open. That's some record.
Head to Head
In this section lets, review the head to head between Nadal and Federer.

Nadal leads Federer in overall head — head, but let us do a deep dive at this

Looking at the above chart, we see that Federer leads Nadal in 2 courts, but Nadal leads Federer by a huge margin in one type of court, resulting in skewness in the overall head to head.
The few head-head on grass does not help much, possibly because Nadal reached fewer finals during Federer’s dominance
Style of play
If Tennis is an art, Federer is the Picasso. He is a genius who will make errors or leave some balls that could have been returned with some effort. His one-handed backhands make you fall in love with tennis, over and over again. His court positioning and judgment is second to none, which is reflected in the high number of volleys he attempts.
Nadal on the other hand is a machine. He will rarely make mistakes and will keep rallying until the opponent wears or hits a winner.
It is like comparing Messi and Ronaldo. Messi works like a genius who is God gifted and Ronaldo is more of an epitome of hard work and determination.
For some, style does not matter though.
Conclusion
In my personal opinion, I think Federer is the greatest tennis player of our time.
His dominance and elegance made me fall in love with tennis. Be it the US Open 2009 tweener against Djokovic in the 2009 US open or the many dominating performances against Roddick, or the amazing rally with Nadal in the 2017 Australian open 5th set (set: 4–3, point: 40–30). The icing on the cake was the epic 2017 comeback Federer made with 2 Grand Slams. The victory over Nadal nearly bought tears to my eyes, and to many Federer fanatics.
On the other hand, I firmly believe greatness cannot be only measured by statistics. We like to convince our pride by believing that we can judge the sportsmen of the stature of Nadal and Federer. We cannot. At the level these players are, we can only respect their achievements. For me, the Federer — Nadal rivalry increased my fascination towards tennis. The nail-biting finals are just a treat to watch for the neutral fans and a painful emotional roller coaster for the Fedal fans.
I’ll end this by something I read online a while back—
Nadal is like a highly trained pianist who can play any of Chopin’s greatest and toughest compositions with ease, often beating Chopin for speed and accuracy. As for Federer, with the single-handed backhand down the line and the net kissing drop from behind the baseline, well, is Chopin himself
Reference:
Kaggle for some of the analysis — https://www.kaggle.com/sijovm/atpdata