# Thoughts on language for Intro to Data Science?

Next term, I'm going to teach an introductory Data Science class for the first time. In the past, others have taught it in either R or Python. My first inclination was to teach it in R because the language is specifically for statistics (and not a general programming language like Python). However, I see a lot of promise in Python's Pandas library. I haven't used Pandas myself, but I have more than enough time that I could familiarize myself with it.

What are your thoughts on R vs Python vs a bit of both?

Ultimately, the Data Science curriculum exposes students to both. Which do you think is more appropriate to begin?

Course details:

• Prereqs include CS1 (C++) and Statistics

• Topics include the analytics life cycle, data integration and modeling, relational databases and SQL, text processing and sentiment analysis, and data visualization. Emphasis is placed on reproducible research, code sharing, version control, and communicating results to a non-technical audience.

• First of two DS classes as part of a DS certificate (Minor is < Certificate is < Major) with predominantly Comp Sci and Stats majors enrolled

• I am currently teaching the Advanced DS class (the follow-up course) with a concentration on R, but that could potentially change in the future as well. Sooner or later, if they complete the certificate, they will get experience in both R and Python. The question is which comes first.

• I can choose the textbook, but will give strong preference to free, online resources

• Do the students already know Python or something similar? CS students usually do by the time they get to such a course. – Buffy Mar 22 at 19:48
• The only language they're guaranteed to have previous exposure to is C++. Some other students may have exposure to other languages (Python included), but not all students are CS students because the course is in a cross-disciplinary Data Science certificate program (math and cs). – Kevin Buffardi Mar 24 at 20:54
• What matters are abstractions. That's application types & libraries. The Python syntax & semantics you would need are straightforward in this respect. – philipxy Mar 27 at 22:11
• @philipxy strikes me that while the syntax between Python and R are a bit different, neither the syntax nor semantics are wildly different when it comes to most intro to DS topics. However, I don't think language choices are irrelevant to curriculum design, in particular when trying to cover both languages and determine the most appropriate order. – Kevin Buffardi Mar 28 at 0:11
• Often, these languages are used together. There is no "vs." – ncmathsadist Apr 5 at 14:06

## 4 Answers

The biggest strength of R when it comes to Data Analysis is in its data visualization. As you've mentioned it is a more or less dedicated tool for statistical analysis.

The thing with Python is that you can easily go a bit off course with the lectures because for Statistical Analysis you'll have to understand, install and work with different libraries/APIs for plotting (matplotlib/pandas/plotly) and processing your data (scipy/pandas again/numpy). These may take different approaches for installing and working with besides being tools on their own.

RStudio already sets up everything for you for the most part so you can just focus on implementation; if you happen to need something extra installing packages from CRAN is incredibly easy letting you do it from the script itself rather than opening a terminal with conda or pip or whatever.

My notes:

• If your interest is teaching more Data Science, as a tool in itself, go with R. It will let you focus more on concepts which are general.
• If you're interested in teaching General Programming as a tool for Data Science and maybe other things, go with Python.
• If you like both ideas, I'd start with R and replicate results with Python later to show its integration with different tools. This way your students will see both approaches are feasible in the case they go out there and see it in the job market.
• Nice answer. Welcome to the site. – Buffy Mar 29 at 14:01

In my experience, there is less 'overhead' with R, especially if you use incredible resources like Intro to Data Science<https://rafalab.github.io/dsbook/> and R for Data Science<https://r4ds.had.co.nz/> You can more quickly focus on data wrangling, visualization and stats. I think R is more bang for the buck in terms of getting at data and meaning. Rstudio/ the R community is very supportive, resourceful and smart. In my first Intro to DS class I had thought I would focus on Python but as I experimented I found that I did indeed need to spend much more time teaching syntax and that took away from the focus on the work. For my 'natural born programmer' students, they like Python. For my new students- coming in to work with data but not coming from a programming background- they really like R. The tidyverse has been a godsend (ggplot, dplyr and other libraries) and the libraries/resources for spatial data are awesome. There is no wrong decision- but I think in future I will stick to R for Intro. Eventually, if professional, one needs more than one language but you'll never get to be a professional if you don't get a start!

Python is more widely used in industry and is a general programming language, so will be more advantageous for students.

R will be useful if your students aim primarily for life sciences and/or academic jobs. But even there Python is used extensively.

• Thanks for the reply. I should clarify that in the certificate program, they get experience with both. The question is more about which is better to start with. – Kevin Buffardi Mar 26 at 19:01

As for me, Python is the best thing for entering to Data Science. As you see, among Python is a very popular, mainstream general-purpose programming language, it also has an extensive range of purpose-built modules and community support. Many online services provide a Python API.

• Why do you think that a general-purpose programming language would be more appropriate to learn first in data science, rather than a language specifically for statistical analysis? – Kevin Buffardi Mar 28 at 17:48
• Don't judge me, but this learning system was imposed on me by my university, and this is much easier for me now. – Edanprovidence Mar 29 at 7:38
• By "online service with a Python API", you mean Python packages dedicated to interacting with a Web API like plot.ly? R already has similar things out of the box with R shiny. – lucasgcb Mar 29 at 12:44
• @Edanprovidence sorry no judgment was intended, I was just trying to better understand your reasoning. I appreciate your input. – Kevin Buffardi Mar 29 at 17:32