Site icon R-bloggers

Simplify working with times and dates in R

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

R has some very powerful built-in features for working with dates, times, and time-zones. But power and flexibility rarely correlate with ease-of-use, and this is no exception. The lubridate package comes to the rescue, make things a bit easier when working with chronological data in R.

The paper Dates and Times Made Easy with lubridate provides in-depth explanations of its functionality, but a recent post on the r-statistics blog provides a handy guide to the latest version, with tips on:

  • how to convert string-formatted dates like "13-04-2011" or "04/13/2011" to date objects
  • how to extract time components (weekday, month, hour, second) etc. from chronological data
  • how to set and convert time zones for data with a time (hour-minute-second) component
  • how to calculate time intervals and other arithmetic operations on times and dates

To see these tips, read the post at the r-statistics blog linked below.

r-statistics blog: Do more with dates and times in R with lubridate 1.1.0

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.