Intermediate R
Write R scripts with conditional logic, loops and your own functions, then use lapply, sapply, vapply, regular expressions and dates and times.
Conditional statements, loops and functions power your own R scripts, and the apply functions make that code more efficient and readable. Here you make decisions with relational and logical operators, repeat work over vectors, lists and matrices, and write your own functions with required and optional arguments. Later lessons replace for loops with lapply, sapply and vapply, search and replace text with regular expressions, and calculate with dates and times.
What You Will Achieve
- Combine relational and logical operators to steer a script through if, else if and else branches.
- Write while and for loops that react to conditions and exit early with break or skip ahead with next.
- Write custom R functions with required and optional arguments, then swap explicit loops for lapply, sapply or vapply.
- Detect and replace text patterns with grepl, grep, sub and gsub, and calculate with dates and times in R.
Program Overview
Conditionals, Control Flow and Loops
Comparing R objects, combining TRUE and FALSE values, and repeating code until a condition changes or a sequence ends.
- Comparing vectors and matrices
- Combining values with &, | and !
- The if statement with else and else if
- While and for loops with break and next
Writing Functions and the Apply Family
Reading documentation, building your own functions, loading packages, and applying a function over a list or vector.
- Function documentation and optional arguments
- Function scoping and passing arguments by value
- Loading an R package
- lapply, sapply and vapply, including anonymous functions
Utilities for Text, Data, Dates and Times
Useful built-in tools for math, data structures, regular expressions, and working with times and dates.
- Mathematical and data utilities
- Pattern matching and replacement with regular expressions
- Creating and formatting dates and times
- Calculations with dates and times
Certificate Awarded (Paid)
Complete all course activities to earn it.
Job Outlook
Control flow, custom functions and text and date handling in R are used in data manipulation and analysis work, where analysts and data scientists write scripts to clean and process data.
Good for: R learners ready to move past single commands and write scripts that make decisions, repeat work and handle text and dates.
Keep in mind: Despite its Beginner label, it is meant for learners who already write basic R code and want to take the next step.
Bottom line: A practical step into R programming that pairs control flow and custom functions with the apply family, regular expressions and date arithmetic.
Frequently Asked Questions
Do the videos have transcripts?
Yes. Each video carries a live transcript that you can reveal with the Show transcript control at the bottom left of the player, which helps when you want to reread an explanation.
What does the apply family chapter cover?
It applies a function over a list or vector with lapply, using built-in functions, your own functions, anonymous functions and extra arguments, then moves to sapply, what to do when sapply cannot simplify, and vapply.
Which date and time functions does it use?
The date and time lessons work with Sys.Date() and Sys.time() for the current moment, and with as.Date() and as.POSIXct() to create and convert date and time objects before calculating with them.
What kind of practice do the lessons include?
Most lessons are short exercises built around one task, such as finding the error in a piece of code, building a while or for loop from scratch, or reverse engineering what sapply returns.


There are no reviews yet.