2
$\begingroup$

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

$\endgroup$
  • $\begingroup$ Do the students already know Python or something similar? CS students usually do by the time they get to such a course. $\endgroup$ – Buffy Mar 22 at 19:48
  • $\begingroup$ 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). $\endgroup$ – Kevin Buffardi Mar 24 at 20:54
  • $\begingroup$ What matters are abstractions. That's application types & libraries. The Python syntax & semantics you would need are straightforward in this respect. $\endgroup$ – philipxy Mar 27 at 22:11
  • $\begingroup$ @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. $\endgroup$ – Kevin Buffardi Mar 28 at 0:11
  • $\begingroup$ Often, these languages are used together. There is no "vs." $\endgroup$ – ncmathsadist Apr 5 at 14:06
8
$\begingroup$

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.
$\endgroup$
  • 2
    $\begingroup$ Nice answer. Welcome to the site. $\endgroup$ – Buffy Mar 29 at 14:01
2
$\begingroup$

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!

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – Kevin Buffardi Mar 26 at 19:01
-1
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ 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? $\endgroup$ – Kevin Buffardi Mar 28 at 17:48
  • $\begingroup$ Don't judge me, but this learning system was imposed on me by my university, and this is much easier for me now. $\endgroup$ – Edanprovidence Mar 29 at 7:38
  • $\begingroup$ 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. $\endgroup$ – lucasgcb Mar 29 at 12:44
  • 1
    $\begingroup$ @Edanprovidence sorry no judgment was intended, I was just trying to better understand your reasoning. I appreciate your input. $\endgroup$ – Kevin Buffardi Mar 29 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.