Sign up for our newsletter and get the latest big data news and analysis.

Should You Use Python or R for Your Programming Language?

When it comes to choosing a programming language, there really are only two choices if you’re working with data. For data science, machine learning, statistics, IoT technology and even automation, the two best languages to use are Python and R.

Narrowing down the focus to those two languages is easy, but unfortunately, choosing between them is not so simple. It doesn’t help that most resources will go into extreme detail about each language, but they stop short of ever choosing which one is the best option.

That’s quite honestly because each of these two languages has their own set of pros and cons. This makes them the ideal choice in varying situations, depending on what you’re trying to develop and how you’re planning to use them. That doesn’t necessarily mean neither is better than the other, but it does mean your choice between the two will most likely differ depending on the project and scope of your work.

Python vs. R: What’s Different About Them?

Right off the bat, the first thing you need to understand is that Python is a general programming language. It can be used to develop and code a lot of things, from games to web applications and desktop software. That’s also why Python is more popular and why you can find more work as a Python developer. It doesn’t necessarily mean R development work is in short supply, just that Python projects are much easier to find.

R is a programming language you will only find in a data science environment. This means R can seem much more limited on the outside, but that’s not necessarily true. This stigma is bolstered by the fact that you would use R more commonly for standalone computing and analysis on servers. In the real world, you’ll encounter it on more of a case-by-case basis because of how it is used.

Both languages are open-source, have a wide variety of advanced tools and IDEs, have extremely supportive development communities and offer reliable and well-paid career opportunities. So, if your concerns relate to any of those things, your decision is going to be even tougher.

When working with big data and cloud-based systems, the decision can become even more difficult. There are industry-specific programs that allow users with no programming knowledge to test software, and many of them run on Python. This relates to using scripts in big data and is an exceptional tool for less-advanced and technical users — this also plays into one of the biggest issues with R, which we’ll get to next.

Two of the biggest cons of R is that the language is slow — on purpose — and it has a remarkably steep learning curve. R was developed in full by statisticians and data scientists, so it has more of a complicated and specific purpose.

One of the cons of Python is that it’s a relatively immature language for data science and facilitation. Also, there are so many visualization and graphical options, it can be overwhelming when you’re trying to put together data in a more organized and easily readable format.

When to Use Python or R

That said, here’s my recommendation, which should be looked at as more of a general rule:

If you are simply working with data science, then you should use R.

If, however, data science only happens to be one of the things you’re focused on, and you want the option of adapting your data and content to other mediums, then Python is the way to go.

The reason I recommend Python for the latter scenario is because it is specifically a general purpose language. This means you can directly export — or import — your data to use for other purposes.

With R, you would have to translate your data or information into a more usable form, if you want to apply it to another application or medium.

If that sounds confusing, here’s a more in-depth example:

So, for instance, let’s say you are collecting a wide variety of data on your customers. You can work with this data — from a server and development approach — using either language. If the data is simply going to stay data, and you are only going to look at the statistics, trends and patterns, then R is your best bet.

However, if you are going to take that data to develop a personalized product recommendation system for your website, for example, then Python will allow you to directly utilize the information and content you have, without starting from scratch.

Python and R are both valuable. You just have to know how to use them.

Contributed by: Kayla Matthews, a technology writer and blogger covering big data topics for websites like Productivity Bytes, CloudTweaks, SandHill and VMblog.

 

Sign up for the free insideBIGDATA newsletter.

 

Comments

  1. Mark Lewis says:

    I agree with this post if you are working with small data sets that fit nicely in the memory of a single machine and you can deal with the speed issues that come with both Python and R. However, if you are going to work with large data sets, that means you need to use a framework that distributes across many threads on many machines. These days, the primary framework for doing that is Spark, and the natural language of Spark is Scala. For that reason, I would argue that if you are going to be working with “big data”, then you really need to consider adding Scala to your toolbox.

Leave a Comment

*

Resource Links: