Python vs. R

Nick K.
3 min readApr 10, 2021

An ongoing debate about the utility of the two most commonly used languages in data science, Python and R, has given rise to fanatics on both sides. Much like the rivalry between Barcelona and Real Madrid, what we can all agree on is that we love our sport (data science, in this case).

There is a large degree of overlap between the two languages, both can be used to solve a variety of data related problems. Python is like a Swiss army knife, well suited to most general tasks. R, on the other hand, allows for more niche statistical analysis. In this article we will examine some of the similarities and differences between these two languages.

Naming Conventions

In Python, variable names are often expressed using underscores. For example, a list variable might be defined as:

my_list = ['this','is','a','list','of','strings','in','Python']

In R, however, variables are often denoted with a period separating the different words. This might be confusing because periods in Python act as operators (.append, .extend, .insert, .remove, etc).

my.list = c('this','is','an','example','of','a','vector','in','R')

Data Types

One of the most common and often used data structures in R is the vector. It is functionally equivalent to a Python…

--

--