4 - R Building Blocks

Objectives

  • Introduction to RStudio
  • Introduction to Core R Data Types
  • Introduction to R Control Flow
  • Overview of R Data Input and Output
  • R Data Wrangling: Transformation using Base R
  • Introduction to scripting with R

Topics

  • Basic RStudio tour: console, editor, environment/build/git, help/packages
  • How to run RStudio: Application, Server, Cloud
  • Basic Data Types
    • Vector, Matrix, … of int, double, char, logical, …
    • Date, Datetime, factors, …
    • NA, NaN, NULL
    • If time: More on types, dispatch, classes, …
  • Compound Types
    • DataFrame
    • List
  • Not Covered
    • Closure
    • Environment
    • Language Object
  • Getting Data In is part of just about any analysis!
    • R excels at this
      • truly broad coverage of file formats
      • as well as ‘backends’ such as databases
      • or different web-based APIs
    • Our focus: read/write of csv data
    • Mention other formats: json, xml, …
    • Efficient R-specific storage: rds
    • Mention protobuf, msgpack, feather, fst, …
  • Data wrangling topics
    • data.frame manipulations
    • modifying by adding columns
    • subsetting and summaries
    • conditional operation by groups
    • merging (and its relationship to SQL joins)
    • functional programming approaches
  • Rscript and r
  • docopt

Core Material

Lecture Slides

Lecture Videos

The core videos which complement the slides are the (now captioned) versions of the 2021 course. As the captions may obstruct some of the displayed code, we also show the uncaptioned original versions.

Extras

Additional Resources