Manipulating Time Series Data in R
Master time series data manipulation in R, including importing, summarizing and subsetting, with zoo, lubridate and xts.
Start Course for Free4 hours15 videos49 exercises3,223 learnersStatement of Accomplishment
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Training 2 or more people?
Try DataCamp for BusinessLoved by learners at thousands of companies
Course Description
Learn All About Time Series Data
Working with data that changes over time is an essential skill in data science. This kind of data is known as a time series. You'll learn the foundations of what a time series represents, how to retrieve summary statistics about the data in a time series, and how to interpret a time series visually.Master Manipulation of Time Series with zoo, lubridate and xts
You’ll master using the zoo and lubridate packages to import, explore, and visualize time series data in R. You’ll learn to retrieve key attributes of time series information, such as the period of that data and how often the data was sampled, gaining fluency in converting between data frames and time series along the way. Further, by aggregating your data, you’ll learn to see the overall trends in the data using the xts package.Perfect Your Subsetting Skills
You’ll cover how to subset a window from a time series to focus on a particular period of interest. You’ll sample time series data at various rates, such as every minute, hour, month, or year. You'll also learn methods of 'imputing' your data – filling in missing values with constant fill, LOCF, or linear interpolation methods. You’ll also learn to create “rolling” windows of a time series that move, or "roll" along with data, making it possible to summarize trends in the data across time. You will also learn how to create expanding windows, which show how these summary statistics approach their final value.Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.In the following Tracks
- 1
What Is Time Series Data?
FreeYou'll learn the foundations of what a time series represents, how to retrieve summary statistics about the data in a time series, and how to visually interpret a time series plot as part of the exploration step of your analysis. You’ll also cover how to manage date and time information within R objects and ways of incorporating consistent formatting for dates.
What is time series data?50 xpPlotting time series with autoplot100 xpTime series summary100 xpInterpreting time series plots100 xpTemporal data classes in R50 xpFinding the class50 xpis-dot functions100 xplubridate's as_date100 xpFormatting dates in R50 xpConversion specifications100 xpParsing and formatting dates100 xp - 2
Manipulating Time Series with zoo
Here, you’ll learn to retrieve key attributes of time series information, such as the range in time of the data and how often the data were sampled, to understand your data better. You'll also be introduced to the zoo package, which contains tools and functions for creating and manipulating time series objects. Many data science applications in R use the data frame paradigm; you'll learn how to convert between a data frame and a time series.
Time series attributes50 xpTemporal attributes and decimal dates100 xpComparing temporal attributes100 xpTime series objects with the zoo package50 xpCreating a zoo100 xpzoo and ggplot2100 xpManipulating zoo objects50 xpUpdating and replacing indices100 xpFinding overlapping indices100 xpConverting between zoo and data frame50 xpMoving between data.frame and zoo100 xp - 3
Indexing Time Series Objects
You’ll cover how to subset a window from a time series to focus on a particular period of interest. You’ll see that when working with real-world time series data, the timespan of your dataset may cover more information than you need, which can clutter your visualizations. You’ll sample time series data at various rates, such as every minute, hour, month, or year. Further, by aggregating your data, you’ll learn to see the overall trends in the data using the xts package. You'll also learn methods of 'imputing' your data – filling in missing values with constant fill, LOCF, or linear interpolation methods.
Subsetting a window of observations50 xpSelecting a window from a time series100 xpFinding an observation from a specific date100 xpLogical expressions and subsets100 xpMonthly and quarterly data50 xpzoo::yearmon100 xpzoo::yearqtr100 xpResampling and aggregating observations50 xpAggregating data100 xpCustom aggregation level100 xpPlotting an aggregated time series with ggplot2100 xpImputing missing values50 xpImputation methods100 xpConstant Fill100 xpLast observation carried forward (LOCF)100 xpLinear interpolation100 xp - 4
Rolling and Expanding Windows
You’ll learn to create “rolling” windows of a time series that move, or "roll" along with data, making it possible to summarize trends in the data across time, such as the average over success months of observations or the sum over several weeks of sales. Overall summary statistics, like mean, median, sum, maximum, and so on, do not always provide insight into how data changes over time, and rolling windows will allow you to compute statistics dynamically. In addition to rolling windows, you will also learn how to create expanding windows, which show how these summary statistics approach their final value.
What is a rolling window?50 xpRolling window functions100 xpRolling windows versus aggregation100 xpApplying functions to rolling windows50 xpRolling minimum100 xpRolling apply with a custom function100 xpExpanding windows50 xpRolling versus expanding windows100 xpExpanding sum100 xpExpanding mean100 xpCongratulations!50 xp
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.In the following Tracks
collaborators
prerequisites
Working with Dates and Times in RHarrison Brown
See MoreGraduate Researcher
Harrison Brown is a Graduate Researcher and Course Instructor at DataCamp! He has a background in Geography, Cartography, and GIS, and loves making maps and visualizations in R, Python, and ArcGIS.
What do other learners have to say?
Join over 15 million learners and start Manipulating Time Series Data in R today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.