How to Create a Bar Chart Using ggplot2 in R
How to Work with Scales in a ggplot2 in R
How to Install and Load ggplot2 in R

How to Go Beyond Date and Time Basics in R

If you only know the basics of how to handle dates and times in R, you may want to explore additional functionality available in R and add-on packages by looking at the following:

  • chron: R has a chron class for datetime objects that don't have a time zone. To investigate this class, first load the chron package with library(chron) and then read the Help file ?chron.

  • lubridate: You can download the add-on package lubridate from CRAN. This package provides many functions to make it easier to work with dates. You can download and find more information at.

R also has very good support for objects that represent time series data. Time series data usually refers to information that was recorded at fixed intervals, such as days, months, or years:

  • ts: In R, you use the ts() function to create time series objects. These are vector or matrix objects that contain information about the observations, together with information about the start, frequency, and end of each observation period. With ts class data you can use powerful R functions to do modeling and forecasting — for example, arima() is a general model for time series data.

  • zoo and xts: The add-on package zoo extends time series objects by allowing observations that don't have such strictly fixed intervals. You can download it from CRAN at. The add-on package xts provides additional extensions to time series data and builds on the functionality of ts as well as zoo objects. You can download xts at CRAN.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Change Values in a Vector in R
How to Use Quantile Plots to Check Data Normality in R
How to Create an Array in R
How to Use Trigonometric Functions in R
How to Make a Minimal Reproducible Example to Get Help with R
Advertisement

Inside Dummies.com