Tag Archive for: R Programming

R Vs Python For Data Science: The Only Advice You Need

Another R vs Python debate?

Nope, it’s not.

Far from it.

I understand your concerns.

If you are reading this story, you have probably come across a few reviews or participated in similar discussions.

Deciding between two popular programming languages to do data science has never been this heated among professionals.

The debate is endless and to some extent, needless.

You have probably read a handful of resources on Quora, Medium, or YouTube about which one to learn.

It did not help but get you more confused because there was never really a clear winner.

I found myself in the same boat years ago. I read tons of articles on which language was better.

The more I tried to see which one was the best based on the reviews and comments, the more confused I became.

It actually got worse that I spent more time reading reviews and comments than learning and solving problems with what I already knew.

The excellent advice never came until I found a simple solution that worked.

This post will uncover the myths surrounding which of the two popular data science languages you should learn and why.

#1 — Find Out What Your Community Uses

Figuring out what your team uses and how your work will be utilised down the pipeline will help you decide

The easiest way to choose is to find out what your community uses. You won’t go wrong doing this.

For example, I have a background in Public Health. When I researched this industry, both in academic and in the profession, most professionals or experts I have met use R. I am not saying Python is not great, but that’s what the community uses.

So this tells one thing.

If I intend to join the workforce one day and probably have a mentor or provide mentorship to other budding data scientists, then R is my best bet.

Once I realised this fact, I did not think twice. I stopped reading reviews about which one language was better and focused on learning by solving real projects.

If you have a Computer Science or Engineering background and work with a data team, it might be better to choose Python.

Python is a multi-purpose language. Asides from data science, it can also be used for web development, artificial intelligence, and the like. So your technical teams might prefer to have scripts written in Python.

Figure out what your team uses and how your work will be utilised down the pipeline. This will make your choice easier.

#2 — Start With One

For starters, learning both at the same time is not a great idea

You have probably read articles, reviews, and comments asking you to learn both. I would not recommend this for beginners.

Sometimes, learning something new is not fun.

Programming languages are even worse because the texts are not intuitive. Your goal is to learn it in the easiest way possible and become comfortable.

Therefore, I would highly recommend learning one first, not both. If you attempt to learn and understand both while starting, you might get confused, and this will impact your progress.

Therefore, focus on one when starting.

Which one should you learn?

Go back to step 1.

#3 — Slowly Pick Up The Other

Be a master at one, then slowly pick up the other in your spare time

You have discovered what your community uses and picked it up quickly.

This is fantastic.

Your next move once you become terrific (I would recommend at least a year working daily and solving problems), you can slowly see what the other language has to offer.

Get comfortable and ensure you are building real projects with one before you pick up the other language. Don’t just learn the basics and assume you are good enough.

It’s easier to pick up another language once you become very comfortable with one language.

For example, I worked with R a lot, but I have picked up Python. I am getting so comfortable with Python that I started learning another Python framework like Django for web development. It’s that easy.

Final Thoughts On The R Vs Python Debate

Data Science is fascinating, but the argument about the tool to use for data science is unnecessary and confusing.

You will do yourself a huge disservice if you keep looking for the best.

The best one is the one you stick to and use to solve your problems and add value to your work or organisation.

You don’t have to spend months seeking the best. This time can be spent learning to become better or solving problems.

Action Points

— Stop reading comparisons

— Start with what your community use

— Develop your skills using this language by building projects and solving problems

— Become comfortable with the other language by slowly picking it after mastering the first language

How Persistence Made Me A Data Scientist

I have read several stories of how professionals became Data Scientists. For many people, it was pretty straightforward. They enrolled in a data science, engineering or computer degree. These individuals were already proficient in one or more several languages, and it was comfortable for them to dive into the world of data. Others like me are self-taught.

My experience was not straightforward. It was the most challenging learning experience I had ever had to overcome.

So why was this the case for me?

The Idea

Nowadays, you need more than education to impress employers

While I was completing my Master of Public Health degree at the University of Queensland, Australia, I realised I needed to improve my technical skills to become more competitive in the job market. I knew grades were not enough.

I chatted with a close friend and mentor, who I have known since childhood, and he suggested that I try to learn a programming language.

He knew my strengths and he was a programmer with one of the big five tech companies.

Like many professionals starting with coding, I asked myself, “Why”?

  • What benefits would it add to me?
  • How would this add value to my public health background?
  • What problems would I need to solve?
  • What would I achieve by writing texts that I do not understand?

I was already learning fundamental statistical analysis using some software tools as part of my coursework, but I did not necessarily fancy them beyond the classroom.

The Initial Encounter

Taking action is critical to achieving success. No action, no results.

Anyway, I decided to give it a shot and spoke to one supervisor at Uni. My first experience writing my first line of code was not particularly helpful.

He sat with me one quiet afternoon, and we installed a programming language on my computer. He wrote:

print (“hello world”)

He pointed at the console, asking me to observe the output. I did. I saw a faint looking output:

>>>hello world<<<

I muttered: “Yes, I can see it”.

I asked myself: so what?

It did not help but get me confused.

Because seeing “hello world” on my screen didn’t make any sense to me. Why say hello to the world?

But I would not give up, noting the benefits a mentor had spoken of. He had even joked that I would be like “Lionel Messi” if I could master a programming language. He said all companies (like football clubs) would want me as I would be able to solve a wide range of problems.

Learning Experiences

It is okay to get confused at the initial stages. Keep going.

I later discovered my institution organised training sessions on various subjects. I looked at the available sessions and found they had some introductory courses in R.

I decided to enrol for the “Introduction to R” course. I was in a class of about ten students, so I thought there was some interest in this subject and I should understand the concept.

I was wrong. I got more confused.

The instructor started by stating some uses of R.

  • Instructor: You can use your R program like a calculator.

Me: (in my thoughts): but I already have a calculator on my phone and PC. So why install this software because of a calculator?

  • Instructor: “You can use R to create folders.”

Me: (in my thoughts): Oh well. I can do that by right-clicking on almost anywhere on my windows PC and choosing “New Folder”.

He continued:

  • Instructor: You can import your dataset from Excel into R

Me: (in my thoughts): Oh, well. Why would I need to do that? The spreadsheet is already good in Excel. Isn’t that what it is built for?

He also discussed some built-in functions and additional packages from libraries.

To make it worse. He added that we could print statements in the console. He used the print (“ hello world”) statement. Not again. I got even more confused.

The rest of the class looked like magic. Most of my codes didn’t work, as I often messed up the syntax.

He would perform some basic analysis and plot some graphs in R. I asked him why I would need to go through this drama of writing foreign scripts to plot simple charts. I gave a list of other “easy” software I could use to perform the same tasks like MS Excel.

I kept asking questions. I even suggested another version of R with a Graphical User Interface (R Commander) that could accomplish the same tasks.

The class ended after two hours. I learnt nothing other than that there is new software that can be used to do things in harder and more complicated ways.

I returned to the class a second time

About a week later, I was back for the same training session with the same trainer. I did not understand any of the concepts the first time, so I thought I should attend another session to aid my understanding.

He repeated the same things from the first class to the second class. It didn’t help my confusion. This time, I asked fewer questions because I tried to understand them.

After two hours, the classes ended, and I left. I understood nothing — same confusion.

I attended the same introductory class about 3 or 4 times more. I got nothing. In fact, the tutor became familiar with my full name. I am sure he had seen it pop up in his registration list repeatedly. I am sure he wondered what I was doing and why I kept coming back for an introductory course. I had attended a few other training classes he led, so he knew I was not dumb.

I kept asking myself why. I hadn’t found a helpful answer to why I would need to write these complex codes to complete these simple tasks.

The Final Encounter

As a Master of Public Health student, I had to work on a dissertation. As part of this research, I had to work with primary or secondary data, which was quite large, dirty and complex. It took me days to manipulate and summarise this data into the shape I wanted using Excel.

Halfway into this project, I realised I used an old dataset. There was a newer version. I felt terrible but had had no choice other than to begin afresh.

It took me a couple of days to get through, but I finished in time to submit my dissertation. I did not have advanced Excel skills, so it might take other Excel gurus less time to complete the task.

So, one day, I expressed an interest to have a one-on-one problem-solving session with my R tutor. Students and staff had the opportunity to meet with trainers to solve a particular data problem using R.

I had said to myself: let’s see how this guy would solve this problem with this software.

One morning, I headed to the school library and there he was waiting at the library. I handed him the excel files I used for my projects and showed him the expected output.

We sat down, and he coded my one week’s worth of hard work in half-hour!


I said, hang on! What if the data changed the following month (since I initially used the wrong data and had to re-do the project). He said: of yeah, that’s easy. You just run the script over the new dataset. I pointed him to a new dataset, and BOOM!!!, we had the new results in less than one minute.

Oh, sugar! Where were you when I was preparing my thesis (my thoughts)?

He saved the scripts as a file, emailed it to me, and said I could run it anytime I had a new dataset.

I still remember this day. It felt like the day the earth shook. I happily returned home with the scripts and did not go to bed that night until I repeated all the steps to ensure they made sense.

Closing thoughts

I hope my personal learning experience has given you a few ideas on how to learn anything you want if you develop a genuine interest and are persistent through the process.

Sometimes, it takes a lot of persistence to understand the benefits of a new lesson or subject to you. It might also be helpful if you try to envision the end from the beginning and use the new lesson or learnings to solve a familiar problem.

The final encounter changed my life. I would not imagine being where I am today if I didn’t take this extra step to challenge him to solve a familiar problem. It helped me land multiple jobs and doubled my income as well.

Whatever it is, you are learning. Remember, don’t give up — success is just around the corner.

Good luck with your learning journey. Let’s connect on LinkedIn.