Country or region and language

    Choose your country or region and your language.

    Suggested for you

      All countries and regions

        Choose your character

        It shows in the top bar and on your profile. Change it any time.

        Courses / Data and analytics tools

        R programming tutorial and practice

        An R programming tutorial in a working R session in your browser. Every lesson has worked examples, then practice scripts checked against the result, from vectors and data frames to dplyr, tidyr, ggplot2 and statistics. Four projects and two mock exams come at the end.

        Start lesson 1Practice interviewTake the assessmentPractice the first unit of every course. No account needed.
        69lessons
        385checked exercises
        11projects, cases and exams
        Prepares you for Data analyst and data scientist roles that ask for R

        What you will be able to do

        • Filter, sort, summarize and join tables with dplyr, and handle missing values on purpose
        • Reshape data with tidyr and clean text, dates and categories with stringr, lubridate and forcats
        • Draw bar, line and scatter charts with ggplot2, with facets, labeled axes and reference lines
        • Write your own functions and repeat steps over columns, groups and files with purrr
        • Compare groups with t-tests, fit linear and logistic models, and bootstrap an interval
        • Analyze an A/B test, a price test and staff turnover from raw data to a recommendation

        Who it is for

        You're moving into a data analyst role that uses R
        The course follows the tidyverse way analysts write R today, from the first data frame to grouped reports.
        You know Excel or SQL and want to script your analysis
        Every lesson uses business tables you'll recognize, so you learn R by doing work you already understand.
        You have an R take-home test coming up
        The last unit has hard interview questions and two timed 45-minute tests in the style of an analyst screen.

        What you can practice free

        Unit 1, R basics: 5 lessons and 28 checked exercises, with no account or card.

        Start the free unit

        The rest of the course opens with a One Course or All Access plan. See plans and prices

        Keep going in R

        Choose access here. Your course is already selected.

        One Course

        Every lesson, project and mock exam in R.

        Loading price/ month

        Billed monthly. Cancel any time.

        All Access

        Every course, exam and project, plus the Interview Hub.

        Loading price/ month

        Billed monthly. Cancel any time.

        Projects, case studies and mock exams

        Project · IntermediateTamarack fleet service report

        Clean a messy fleet export, parse its dates, flag overdue bikes, join districts and chart the result for the operations manager.

        6 steps · 40 min
        Project · AdvancedFernhill campaign review

        Clean a campaign export, work out cost per order and return on ad spend, compare channels and months, and chart revenue for the quarterly review.

        7 steps · 45 min
        Case study · AdvancedLumen Books checkout test

        Analyze an online checkout test end to end: conversion, lift, two significance tests, revenue per session and a decision.

        6 steps · 35 min
        Project · ExpertSaltmarsh attrition review

        Find where staff turnover concentrates at a logistics company: rates by department and overtime band, ratings, a test, a logistic model and a chart for the HR director.

        7 steps · 50 min
        Project · ExpertOrchard Lane operations dashboard

        Build the numbers behind a weekly fulfillment dashboard: lateness, weekly on-time rates per warehouse, carrier KPIs, a chart against target, the worst week and overdue shipments.

        6 steps · 45 min
        Case study · ExpertKestrel Software price test

        Pick a launch price from a randomized price test: conversion and revenue per visitor, elasticity, a significance test and a projection.

        6 steps · 35 min
        Mock exam · ExpertBramble & Pine garden centers

        A 45-minute take-home style test on a garden center chain's April sales: cleaning, joins, ranks, a chart, a function, a test and a reshape.

        8 questions · 45 min
        Mock exam · ExpertBluewater Ferries

        A 45-minute take-home style test on a ferry operator's sailings: load factors, punctuality, sold-out sailings, weekly change, a function, a chart and a correlation.

        8 questions · 45 min

        Write and run real R in your browser, in the four-pane layout R users work in: a script, the console, the environment and your plots. You start with values, vectors and data frames, then filter, sort and summarize tables with dplyr and draw charts with ggplot2. Later units cover importing and cleaning messy data, joins, reshaping with tidyr, text and dates, functions and iteration, and the statistics analysts use most. Projects ask you to clean, analyze and chart data for fictional companies. Every answer is checked on a second copy of the data, and the course ends with interview practice and two timed tests.

        Interview practice

        Explain what you've learned in a full-screen interview. Speak or type, then review your answers against the rubric for your level.

        Interview loops by job

        Beginner

        FreeNo account or card needed. Every lesson in this unit is yours to practice.

        R basics

        Values, vectors, functions and data frames, the pieces every R script is made of.

        5 lessons

        Pick rows and columns

        Filter rows, handle missing values, choose columns and sort with dplyr and the pipe.

        6 lessons

        New columns and summaries

        Calculate columns, label rows, and summarize whole tables and groups.

        6 lessons

        First charts

        Draw scatter, bar and line charts with ggplot2, label them, and answer easy interview questions.

        6 lessons

        Intermediate

        Import and clean

        Read CSV exports, turn text into numbers, handle missing values and remove duplicates.

        5 lessons

        Joins

        Combine tables with left, inner and filtering joins, handle awkward keys and stack exports.

        5 lessons

        Tidy data

        Reshape between wide and long, split and join columns, and fill missing rows and cells.

        5 lessons

        Text, dates and categories

        Clean text with stringr, work with dates in lubridate, order categories with forcats, then build a fleet report.

        5 lessons

        Advanced

        Grouped patterns

        Compare rows with their neighbors, keep running totals, rank within groups and summarise many columns at once.

        5 lessons

        Functions and iteration

        Write your own functions, repeat steps over columns, groups and files with purrr, and stack the results.

        4 lessons

        Charts for a report

        Small multiples, axis scales, reference lines and labels, then a campaign review for a marketing lead.

        3 lessons

        Statistics basics

        Correlation, linear models and t-tests, an A/B test case study and medium interview questions.

        4 lessons

        Expert

        Reproducible and fast

        Seeds, checks and parameters, the bootstrap and simulation, and vectorized code that replaces loops.

        4 lessons

        Expert projects

        An HR attrition review, an operations dashboard and a pricing case study, each from raw data to a recommendation.

        3 lessons

        Interviews and timed tests

        Hard interview questions and two 45-minute mock exams in the style of an analyst take-home test.

        3 lessons

        Common questions

        Do I need to install R?

        No. R runs in your browser through webR, in four panes laid out the way R users work: a script, the console, the environment and your plots. The first lesson downloads R once, then it stays in your browser cache. It isn't RStudio, and The Work Gym isn't affiliated with the R Foundation or Posit.

        Is it free?

        The first unit is free and needs no account. The rest of the course opens with a One Course or All Access plan, and the pricing page shows every plan and its price.

        How are my scripts checked?

        By the objects your script creates: tables, numbers and charts. Each answer is run again on a second copy of the data with other values, so the code has to be right, not just the numbers you can see. A wrong answer gets a hint that names the likely mistake.

        Does it cover statistics?

        The Advanced and Expert levels cover correlation, linear and logistic models, t-tests and proportion tests, the bootstrap and simulation, used inside realistic case studies.

        How long does the course take?

        About 23 hours if you do every lesson once. Most lessons take 15 to 25 minutes; each timed test takes 45.

        Do I get a record?

        Sign in, and each project, case study and mock exam you finish gives you a record of what you did and when, with a code anyone can use to check it.

        Your Work Gym account

        Save your progress and pick up on another device. Your browser's progress comes with you.

        or

        You can keep practicing without an account.

        Change your plan

        Checking the price

        Help and feedback

        Ask a question, tell us what is not working, or share an idea. We reply by email.

        What is it about?

        We use it only to reply to you.