R for Marketing Research and Analytics

Chris Chapman and Elea McDonnell Feit
January 2016

Chapter 1: Welcome to R

Website for all data files:

  • These slides are a companion to the book R for Marketing Research and Analtyics. The book is for:
    • Marketing research practitioners seeking to learn R.
    • Data scientists interesting in marketing applications.
    • Marketing students and academics interested in practical applications.
  • Companion code files are available at (http://r-marketing.r-forge.r-project.org/), but we suggest you type each line of code, to begin developing your R skills.

About the authors

Dr. Chris Chapman is a Senior Quantitative Experience Researcher for the Google Cloud Platform, based in the Seattle office.

Dr. Elea McDonnell Feit is an Assistant Professor of Marketing at Drexel University and a Senior Fellow of the Wharton Customer Analytics Initiative.

What is R?

“R is a language and environment for statistical computing and graphics.” http://www.r-project.org/about.html

R is:

  • A programming language (not a “stats program'')
  • An environment for writing code and handling data
  • User extensible through add ons and custom code
  • Open source and freely available
  • Where new statistics and analytics innovation most often happen first

What is R Not?

R is not:

  • Intended for point-and-click usage
  • Designed to hide complexity from the user
  • Necessarily a fast or easy way to do something that is new to you

Like learning a non-computer human language, R takes time, practice, patience, and application to real problems.

Why R?

If it's hard to learn, why is it worth it?

For some users, R is too much. If you don't like programming, you likely will not like R. On the other hand:

  • R is optimized for working with data and statistics
  • The programming language is relatively simple and flexible
  • 1000s of people have contributed additions to R
  • Once you have mastered something in R, it is easy to automate it and become more and more productive


  • R skills are in very high demand

Why NOT R?

  • Full control == more complexity
  • Steep learning curve
  • Don't try to learn R when time is critical!

And perhaps most importantly:

  • R is a programming language.
  • If you have tried computer programming and didn't like it, you probably won't like R

What do you need to use R?

At a minimum:

Also recommended:

RStudio is free and will make your life much easier! To use RStudio, first install R and then install RStudio separately.

Now ...

Make sure R and RStudio are up and running on your systems!

Once it is working for everyone, we'll start with the language.