Welcome to R for Marketing Research and Analytics

Note, April 2019: The 2nd Edition of R for Marketing Research and Analytics was released this month. All code and exercises are posted here as .R files. We will update Exercise Notebooks in coming weeks (basic solutions in R code are available now).

R for Marketing Research and Analytics by Chris Chapman and Elea McDonnell Feit is designed to teach R to marketing practitioners and data scientists. This site contains the latest, updated .R code files; data files; classroom slides; exercises; and errata.

Book cover

Recent Updates

Date Announcement
PINNED July 17, 2020 There are several minor updates related to the release of R 4.0, which has made the largest changes to R in more than 10 years. These involve:

  • Random number generation
  • A new default for data frames, stringsAsFactors=FALSE
  • Errors using the mlogit package for choice-based conjoint estimation
For details and solutions, see the Errata page.

We would note that there are only a few, relatively minor changes needed, for such a major release of R. This demonstrates the impressive stability of base R code over long periods of time.
October 20, 2019 For readers of the 1st edition (and the 2nd), the Exercises and solutions that were added in the 2nd edition are available to you. See the Exercises page for the Exercises PDF and solution .R files.
August 19, 2019 Chris has released a development, in-progress R choicetools package to assist with choice-based conjoint and MaxDiff analyses. See choicetools presentation from UseR! 2019 for details and example code. These tools may assist with choice-based conjoint simulations as discussed in Chapter 13.
May 12, 2019 R 3.6.0, R 4.0 and later (2019-) changed the random number generator. This changes results for data simulation (not downloaded data), exact results from Bayesian statistics, and a few other minor results throughout the book. If you wish to match the book exactly, give the following command after you start R (ignore the warning in this case):


This command has been incorporated into the downloadable .R files. See the Errata page for more options.
April 10, 2019 What's new in the 2nd edition?

The 2nd edition focuses on making the book more useful for students, self-learners, and instructors. This includes:

  • Exercises at the end of each chapter. Exercises page.
  • A new chapter on behavior sequences (such as web logs), with analysis using Markov chains.
  • Classroom slides here (that work for both 1st and 2nd editions).
  • Discussion of how & where one might acquire typical data sets in each chapter.
  • A new appendix introducing reproducible research and the advantages of R Notebooks.
  • Generally updated the code and text as needed to be clearer, correct errors, update packages, etc.
  • March 20, 2019 The Second Edition is now electronically available (early!). We are updating the content here and will be in sync with the 2nd edition in time for the official release date in May 2019. Please check back for updates!
    November 3, 2016 A Chinese translation is now available: China Pub and Amazon China
    . Chinese cover


    The book is available in:

  • Springer
  • Amazon
  • Powell's Books
  • Google Play Store (ebook)

  • Chinese:
  • China Pub
  • Amazon China

  • Japanese (February 2020):
  • Kyoritsu Publishing
  • Amazon Japan
  • Events

    To be announced

    Selected past events

  • Chris and Elea taught a 2-day workshop at the Foster School of Business, University of Washington, January 2017

  • Chris offered beginning and advanced tutorials at: 2016 SKIM/Sawtooth Software Conference.

  • Chris discussed the book in an invited talk at: 2015 Joint Statistical Meetings.

  • Elea presented "Designing New Products Using Choice Models in R" at: PhillyR Meeting, April 2015 [Slides].