R Bootcamp Introduction

Arvind Sharma

Introduction to R and its Importance

What is R?

  • A programming language and environment for statistical computing and data analysis

  • Widely used in academia, research, and industry

Why R in Economics?

  • Powerful tools for data manipulation, statistical modeling, and graphical representation

  • Essential for economic research and data analysis

Documentation tab at the official R website has useful information about R, including The R Manuals

Official R website.

Official R website.

R Manuals.

R Manuals.

Structure of the Bootcamp

  1. Introduction to R Programming

  2. Data Manipulation Techniques

  3. Creating Visualizations

  4. Statistical Analysis

Objectives of the Bootcamp

Skills to Be Acquired:

  1. Learn the essentials of R, including syntax, data types, and basic operations, and script writing

  2. Explore methods to filter, merge, and reshape datasets for analysis

  3. Develop skills to create and customize visualizations for data interpretation

  4. Apply R to conduct various statistical tests and regression modeling

Expectations and Outcomes

Learning Outcomes:

  • Confidently use R for data analysis in economic research

  • Foundational understanding of R for further study and practice

Engagement:

  • Active participation, questions, and interaction

Installation & Setup

RStudio, Inc. is now known as Posit.

RStudio, Inc. is now known as Posit.

Posit Cloud

https://posit.cloud/

Posit Cloud Plans

RStudio interface

4 primary panes.

4 primary panes.
  • Lets play with some settings. Check out Tool -> Global Options -> Appearance

Cheatsheet

  • R Studio Integrated Development Environment (IDE)

  • Check out markdown cheatsheets

https://rstudio.github.io/cheatsheets/

Markdown Documents

  • Quarto (.qmd) and R Markdown (.Rmd) documents are preferred over R scripts (.R ) for creating dynamic reports and documents

    • Combine code, text, and outputs in one document

    • Useful for reproducible research and sharing results (supports various output formats like HTML, PDF, Word, …)

Demo

Lets create our first .qmd script (used with Quarto for creating dynamic reports with enhanced features)

https://www.dataquest.io/blog/r-markdown-guide-cheatsheet/

knitting/rendering markdown

  • WYSIWYG (What You See Is What You Get, pronounced WIZ-ee-wig)

    • Directly represents the final output as you see it in the editor. MS Word.
  • R Markdown/Quarto Markdown (“What You Code Is What You Get”)

    • Final document reflects the code and Markdown you write, which is processed to produce the final output.

Next Steps

Now that you have compiled your first .qmd file, you should try to open and understand basic organisation of other Markdown files

  • Review the Tutorial Files:

    • Modify and experiment with sample files to deepen your understanding
  • Continue Learning:

    • Use the skills you’ve gained to create and customize your own Quarto documents

Appendix

R Books

Book Description
R for Data Science by Garrett Grolemund and Hadley Wickham The best book to learn the latest tools for elegantly doing data science.
The R Book by Michael Crawley As close to an R bible as you can get.
Advanced R by Hadley Wickham A truly advanced book for expert R users, especially those with a programming background. Hadley Wickham is the R guru.
Discovering Statistics with R by Field, Miles and Field A classic text focusing on the theory and practice of statistical analysis with R
Applied Predictive Modeling by Kuhn and Johnson A great text specializing in statistical learning aka predictive modeling aka machine learning with R.

Getting R help and inspiration online

Site Description
www.google.com Seriously, Google is any programmer’s best friend. More likely than not you will be directed to www.stackoverflow.com or www.stackexchange.com
www.r-bloggers.com R bloggers is my go-to place to discover the latest and greatest with R.
blog.revolutionanalytics.com Revolution analytics always has great R related material.