R4phd
  • About
    • Getting started
      • Installation
        • Getting ready for your R course
        • Prerequisites
        • The R ecosystem (and FOSS)
        • R installation
        • RStudio installation
        • R package installation
        • Posit Cloud
        • Check all is ready for R4PHD course
      • Make yourself at home
        • An overview of RStudio
        • Working in the console
        • Working in the text editor
    • Lectures
      • Help from Large Language Models
      • Basics of R and Rstudio
      • Quarto documents
      • Project discipline
      • Import
      • Tidy
      • Tidy - Extra Material
      • ggplot2
      • ggplot2 - Extra Material
      • Factors
      • Missing data
      • Tables
      • Hypothesis tests
      • Regression
      • Reproducible Research – basics
      • Citations
    • Home assignment
      • Home Assignment
    • Self-study
      • Tips for easy living
        • Console vs Editor
        • Parsing R code
        • Need help? RTFM!
        • Weird chðracŁer
        • Bloody parentheses
        • Damn quotation marks
      • Rational workflow
        • Reproducible Research
        • Sourcing scripts
        • Specifying layout
        • Citations and references
        • Zotero bibliography
        • Collaboration
        • Specifying layout
        • Citations and references
        • Zotero bibliography
        • Collaboration
      • Core concepts
        • Variables and functions
          • Variables
          • Assigning value to a variable
          • Basic data types
          • Vectors
          • Data frames
          • Lists
          • Matrices and arrays
          • Functions
        • Data
          • Loading data
          • Inspect your data
          • Missing data
          • Tidy data
      • Advanced R
        • Data
          • Normalization of data
        • Strings
          • Regular expressions
        • Parallel
      • Data adventures
        • Data adventures

    Open course material

    Learn R

    Free, hands-on course material on R, RStudio, the tidyverse and reproducible data science practice.
    Built for our PhD course at SDU, open to everyone.

    Steen Harsted and Søren O’Neill

    Get started Browse lectures

    R4phd logo

    What you will learn

    The material follows the data science workflow: import, tidy, visualise, model and communicate.

    R and RStudio basics

    Console, scripts, projects and Quarto documents — plus how to get good help from docs and AI.

    Import and tidy data

    Read data from files, then reshape, filter and summarise it with dplyr and tidyr. Handle factors and missing values along the way.

    Visualise

    Build clear, publication-ready graphics with ggplot2 and the grammar of graphics.

    Statistics

    Common hypothesis tests and regression models, reported clearly.

    Tables and reports

    Produce descriptive and model tables and render complete reports to HTML, Word or PDF.

    Reproducible research

    Organise projects so others (including future you) can rerun your analyses.

    The 4-day PhD course

    Built for our 4-day PhD course at SDU, mixing short lectures with hands-on exercises and ending in a home assignment on your own dataset. The same material is used in other courses and workshops and is freely available for self-paced learning.

    Good to know

    • No prior R experience required
    • Bring your own laptop
    NoteHow to use this website (click to expand)

    Navigation. The sidebar on the left lists all pages by section. At the bottom of each page you will find links to the previous and next pages, and the search function is in the top-right corner.

    Collapsible boxes. Some content is hidden in collapsible boxes like this one. Click the title bar to open or close a box.

    Tabs. Some content is split across tabs, for example instructions for different operating systems:

    • Windows
    • MacOS
    • Linux

    Microsoft Windows relevant content

    MacOS relevant content

    Linux relevant content

    Screenshots. Screenshots are shown in a thin blue frame. They are images, so you cannot copy their text, their links do not work, and Google Translate will not translate them.

    Created and maintained by Søren O’Neill and Steen Harsted · About us · Licensed under CC BY