Setting Up Your Analysis Environment

Explanation

Before diving into the Q&As, let’s make sure your system is ready.

This section walks you through installing the essential tools needed to run all examples in this guide — using both Python and R side by side.

It’s designed with beginners in mind and focuses on tools that are:

  • ✅ Free and open-source
  • ✅ Cross-platform (Windows, macOS, Linux)
  • ✅ Commonly used in real-world data science workflows

🔹 Who This Is For

This setup guide is ideal for:

  • Learners new to Python, R, or data science
  • Students and professionals starting their first analysis project
  • Anyone looking to build a clean, reproducible workflow

💡 You don’t need to be a programmer to follow along.
Every Q&A is explained clearly — with real-world tasks and paired code in both Python and R.

Let’s begin by installing the core tools that support this dual-language learning experience.


Install Python

  1. Visit the official Python page: python.org/downloads
  2. Download Python 3.9 or later
  3. ✅ During installation, check “Add Python to PATH”

To confirm it’s installed, open your terminal or command prompt and run:

python --version

Install R and RStudio

  1. Download and install R from CRAN
  2. Then download RStudio Desktop (free version) from posit.co

Verify installation in the R console by running:

version

Setup with venv for Python

# Create virtual environment (if not yet created)
python -m venv venv

# Activate it (on Mac/Linux)
source venv/bin/activate

# Activate it (on Windows)
venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Setup with renv for R

# Install and initialize renv (only once)
install.packages("renv")
renv::init()

# Restore the environment (after cloning)
renv::restore()

✅ This ensures R and Python packages remain consistent across machines and contributors.