Introduction to R Programming Course

Aug 6, 2024

Course Introduction

Teaching Assistants

  • Mr. RI Rosinha

    • Research Scholar at Doms Rudki
    • Graduated from University of Delhi and Postgraduated from Jamia Millia Islamia University
    • Areas of Interest: Climate Finance, Financial Markets, Energy Markets
  • Miss Charu Adwa

    • Research Scholar at Doms Rudki
    • Graduation: University of Delhi, Postgraduation: Jamia Millia Islamia University
    • Areas of Interest: Climate Finance, Financial Markets, Market Efficiency, Energy Markets
  • Miss Lagan Jindel

    • Research Scholar at Doms Rudki
    • 1 year of teaching experience in Financial Management and Cost Accounting
    • Graduated and Postgraduated from University of Delhi
    • Areas of Interest: Mutual Funds, Sustainable Finance, Security Analysis, Portfolio Management, Financial Markets
  • Miss Manisha Yow

    • Research Scholar at Doms Rudki
    • Postgraduation from the Delhi School of Economics
    • Areas of Interest: Mutual Funds, Security Analysis, Portfolio Management, Financial Markets, Cryptocurrencies
  • Mr. Mang Gupta

    • Senior Research Fellow at Department of Management Studies, IT RI
    • Specialization in Finance and Accounting from University of Delhi
    • Areas of Interest: Banking, Financial Reporting, Accounting Quality, ESG, Earnings Management, Corporate Governance, CR Risk
  • Miss Disha Mal

    • Research Scholar at Department of Management Studies, IT RKI
    • Graduation and Postgraduation from University of Delhi
    • Research Areas: Banking, Risk Management in Financial Institutions, Information Incentives

R Programming Basics

Objectives of the Course

  • Introduction to R programming and its uses
  • Installation and setup of R and R Studio
  • Familiarization with R Studio interface
  • Creating and managing working directories and projects
  • Installing and managing packages
  • Understanding basic arithmetic and logical operators
  • Working with different data types (vectors, user-defined functions)

Installation of R and R Studio

  • R: Open-source statistical computing environment

    • Easily downloadable for Windows, Mac OS, Linux
    • Supports many statistical applications
  • R Studio: Interactive development environment (IDE) for R

    • Also open-source and available across platforms
    • Provides tools for writing R code, conducting statistical analysis, and data visualization

Familiarizing with R Studio Interface

  • Four main panes:
    1. Source Editor: For creating and editing R scripts
    2. Console: Where R evaluates the code
    3. Environment/History Panel: Shows data objects and command history
    4. Multi-purpose Panel: Access files, plots, packages, help

Working with R Scripts

  • Create, save, and run scripts using the Source Editor
  • Evaluate code directly in the Console
  • Use Environment panel for managing data objects
  • Import datasets via GUI

Setting Up Working Directory

  • Set working directory to organize files
  • Use setwd() command to define the directory
  • Default working directory can be set in Global Options

R Variables and Data Types

  • Five basic data types:

    1. Numeric
    2. Character
    3. Integer
    4. Factor
    5. Logical
  • Vector Creation: Use c() for combining elements

  • Vector Operations: Arithmetic operations can be applied to vectors of the same length; recycling occurs if vectors are of different lengths

Basic Operations in R

Arithmetic Operators

  • Basic operations: Addition, Subtraction, Multiplication, Division
  • Example: a + b, a - b, etc.

Logical Operators

  • Logical and: &
  • Logical or: |
  • Used for Boolean operations and comparisons

Conditional Statements in R

  • Use if, else, and for loops to control flow based on conditions

User-defined Functions

  • Create reusable functions for common tasks
  • Example of defining a mean and standard deviation function

Summary and Next Steps

  • Learners will be equipped to create projects, write basic R codes, and understand data types
  • Next session: Types of data science projects and their lifecycle in R.