📊

Introduction to R for Marketing Analytics

Apr 21, 2025

Marketing Analytics Course: Introduction to R Programming

Course Overview

  • Course offered by Dr. S. H. Vinod at Vinod Gupta School of Management, IIT Kharagpur.
  • Focus on hands-on marketing analytics using software tools.
  • Excel for small problems and R programming for larger data.

Importance of Excel

  • Widely used in management for spreadsheet modeling.
  • Essential for both managers and academicians.

Limitations of Excel

  • Struggles with large datasets (over six lakh rows).

Introduction to R Programming

  • Selected due to its open-source nature and large online support.
  • Suitable for research-oriented tasks; often preferred over Python for backend work in marketing analytics.

Getting Started with R

  • R is downloadable online, freely available.
  • Initial focus on installation of R and RStudio.

Installation of R and RStudio

  • R Installation:
    • Visit CRAN site or Google "R download" for the latest version.
    • Current reference was R 3.6.1, but use the latest version if available.
    • Install by double-clicking the downloaded file.
  • RStudio Installation:
    • RStudio is a more user-friendly interface compared to R’s native UI.
    • Free version available; download RStudio Desktop.
    • Ensure compatibility with your system (64-bit vs 32-bit).

Using RStudio

  • RStudio provides a user-friendly environment to work with R.
  • Four quadrants in RStudio interface:
    • Editor Quadrant: For writing and saving code.
    • Console Quadrant: Where code is run and results are displayed.
    • Environment Quadrant: Displays stored data, variables, etc.
    • Files/Plots Quadrant: Includes tabs for files, plots, and packages.

Basic R Programming Concepts

  • Vectors and Variables:
    • Simple form of data storage in R, similar to columns in Excel.
    • Created using assignment (e.g., a <- 0).
    • Can store single or multiple values.
  • Basic Operations:
    • Run operations using console, e.g., a + b.
    • Use functions to perform tasks like length() to find vector size.

Working with Vectors

  • Create vectors using sequences or combinations.
  • Use comments to annotate code (# comment here).
  • Utilize functions to manipulate data (e.g., seq() for sequences).

Best Practices

  • Clean console regularly (Ctrl + L).
  • Save your work frequently to prevent data loss.
  • Practice writing code manually to learn from mistakes.

Conclusion

  • R and RStudio provide a robust environment for handling larger datasets in marketing analytics.
  • Emphasis on learning through practice and exploration.

Note: Further instructions and continuation will be provided in subsequent sessions.