Skip to main content
HomeR

Working with Dates and Times in R

4.5+
13 reviews
Intermediate

Learn the essentials of parsing, manipulating and computing with dates and times in R.

Start Course for Free
4 hours14 videos48 exercises34,559 learnersTrophyStatement of Accomplishment

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.
Group

Training 2 or more people?

Try DataCamp for Business

Loved by learners at thousands of companies


Course Description

Dates and times are abundant in data and essential for answering questions that start with when, how long, or how often. However, they can be tricky, as they come in a variety of formats and can behave in unintuitive ways. This course teaches you the essentials of parsing, manipulating, and computing with dates and times in R. By the end, you'll have mastered the lubridate package, a member of the tidyverse, specifically designed to handle dates and times. You'll also have applied your new skills to explore how often R versions are released, when the weather is good in Auckland (the birthplace of R), and how long monarchs ruled in Britain.
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.
DataCamp for BusinessFor a bespoke solution book a demo.

In the following Tracks

Certification Available

Associate Data Scientist in R

Go To Track

R Developer

Go To Track
  1. 1

    Dates and Times in R

    Free

    R doesn't know something is a date or time unless you tell it. In this chapter you'll learn about some of the ways R stores dates and times by exploring how often R versions are released, and how quickly people download them. You'll also get a sneak peek at what you'll learn in the following chapters.

    Play Chapter Now
    Introduction to dates
    50 xp
    Recognizing ISO 8601 dates
    50 xp
    Specifying dates
    100 xp
    Automatic import
    100 xp
    Why use dates?
    50 xp
    Plotting
    100 xp
    Arithmetic and logical operators
    100 xp
    What about times?
    50 xp
    Getting datetimes into R
    100 xp
    Datetimes behave nicely too
    100 xp
    Why lubridate?
    50 xp
  2. 2

    Parsing and Manipulating Dates and Times with lubridate

    Dates and times come in a huge assortment of formats, so your first hurdle is often to parse the format you have into an R datetime. This chapter teaches you to import dates and times with the lubridate package. You'll also learn how to extract parts of a datetime. You'll practice by exploring the weather in R's birthplace, Auckland NZ.

    Play Chapter Now
  3. 3

    Arithmetic with Dates and Times

    Getting datetimes into R is just the first step. Now that you know how to parse datetimes, you need to learn how to do calculations with them. In this chapter, you'll learn the different ways of representing spans of time with lubridate and how to leverage them to do arithmetic on datetimes. By the end of the chapter, you'll have calculated how long it's been since the first man stepped on the moon, generated sequences of dates to help schedule reminders, calculated when an eclipse occurs, and explored the reigns of monarch's of England (and which ones might have seen Halley's comet!).

    Play Chapter Now
  4. 4

    Problems in practice

    You now know most of what you need to tackle data that includes dates and times, but there are a few other problems you might encounter in practice. In this final chapter you'll learn a little more about these problems by returning to some of the earlier data examples and learning how to handle time zones, deal with times when you don't care about dates, parse dates quickly, and output dates and times.

    Play Chapter Now
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.

In the following Tracks

Certification Available

Associate Data Scientist in R

Go To Track

R Developer

Go To Track

datasets

Auckland daily weatherAuckland hourly weatherR releasesCran logs

collaborators

Collaborator's avatar
Yashas Roy
Collaborator's avatar
Richie Cotton

prerequisites

Intermediate R
Charlotte Wickham HeadshotCharlotte Wickham

Assistant Professor at Oregon State University

Charlotte is an Assistant Professor in the Department of Statistics at Oregon State University and an avid R programmer with a passion for teaching. Her interests lie in spatiotemporal data, statistical graphics and computing, and environmental statistics.
See More

Don’t just take our word for it

*4.5
from 13 reviews
69%
15%
15%
0%
0%
  • Thomas G.
    9 months

    I always had difficulties to manipulate dates and times, extract some insights… This course is very useful and gave me all the tools to get the maximum out of my datas. I highly recommend this course!

  • Brian K.
    about 1 year

    Awesome

  • Richard L.
    over 1 year

    Great course. Well taught

  • Semiu A.
    almost 2 years

    I so much like the calmness of the facilitator. She is a very great teacher

  • Olga` K.
    almost 2 years

    In addition to a short but effective overview of the theory, the course offers a few problems from real-life examples.

"I always had difficulties to manipulate dates and times, extract some insights… This course is very useful and gave me all the tools to get the maximum out of my datas. I highly recommend this course!"

Thomas G.

"Awesome"

Brian K.

"Great course. Well taught"

Richard L.

Join over 15 million learners and start Working with Dates and Times in R today!

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.