“Getting a data science job would have been much harder without Dataquest. It’s a great product. I recommend it to anyone who asks me about how to get started.”

Adam Zabrodski

Data Science Manager @ Later

Course overview

In this course, you’ll begin by learning control flow (including if-else statements) and conditionals. You’ll then move into learning about functions and functional programming. You’ll also learn about iteration, how to write for loops and while loops, and when and why you might choose to write a for loop instead of employing vectorization in R.

Best of all, you’ll learn by doing — you’ll practice and get feedback directly in the browser. At the end of the course, you’ll work on the first part of a guided project that will enable you to apply control flow loops and functions to create a reusable data workflow.

Key skills

  • Understanding control flow, iteration, and functional programming in R
  • Writing if-else statements, for and while loops, and much more
  • Replicating your code using iterations
  • Writing function using R

Course outline

Control Flow, Iteration, and Functions in R [4 lessons]

Control Flow in R 2h

Lesson Objectives
  • Employ if-else statements
  • Implement curly bracket notation with control flow
  • Employ a for loop in R
  • Employ a while loop in R

Iterations in R 1h

Lesson Objectives
  • Evaluate the importance of iteration
  • Employ a for loop to replicate your code
  • Employ a while loop to replicate your code
  • Identify the importance of vectorization in the tidyverse libraries

Functions in R 1h

Lesson Objectives
  • Define a function
  • Write your own function
  • Employ the map function

Projects in this course

Guided Project: Creating An Efficient Data Analysis Workflow

For this project, you’ll act as a data analyst for a company selling programming books to analyze sales data and extract useful insights to determine the most profitable titles.

The Dataquest guarantee


Dataquest has helped thousands of people start new careers in data. If you put in the work and follow our path, you’ll master data skills and grow your career.


We believe so strongly in our paths that we offer a full satisfaction guarantee. If you complete a career path on Dataquest and aren’t satisfied with your outcome, we’ll give you a refund.

Master skills faster with Dataquest

Go from zero to job-ready

Go from zero to job-ready

Learn exactly what you need to achieve your goal. Don’t waste time on unrelated lessons.

Build your project portfolio

Build your project portfolio

Build confidence with our in-depth projects, and show off your data skills.

Challenge yourself with exercises

Challenge yourself with exercises

Work with real data from day one with interactive lessons and hands-on exercises.

Showcase your path certification

Showcase your path certification

Impress employers by completing a capstone project and certifying it with an expert review.

Grow your career with

of learners recommend
Dataquest for career advancement
Dataquest rating
SwitchUp Best Bootcamps
Average salary boost
for learners who complete a path

Aaron Melton

Business Analyst at Aditi Consulting

“Dataquest starts at the most basic level, so a beginner can understand the concepts. I tried learning to code before, using Codecademy and Coursera. I struggled because I had no background in coding, and I was spending a lot of time Googling. Dataquest helped me actually learn.”


Jessica Ko

Machine Learning Engineer at Twitter

“I liked the interactive environment on Dataquest. The material was clear and well organized. I spent more time practicing then watching videos and it made me want to keep learning.”


Victoria E. Guzik

Associate Data Scientist at Callisto Media

“I really love learning on Dataquest. I looked into a couple of other options and I found that they were much too handhold-y and fill in the blank relative to Dataquest’s method. The projects on Dataquest were key to getting my job. I doubled my income!”

Join 1M+ data learners on


Create a free account


Choose a learning path


Complete exercises and projects


Advance your career

Start learning today