Exercise

Automatic import

Sometimes you'll need to input a couple of dates by hand using as.Date() but it's much more common to have a column of dates in a data file.

Some functions that read in data will automatically recognize and parse dates in a variety of formats. In particular the import functions, like read_csv(), in the readr package will recognize dates in a few common formats.

There is also the anytime() function in the anytime package whose sole goal is to automatically parse strings as dates regardless of the format.

Try them both out in this exercise.

Instructions

100 XP
  • Use read_csv() to read in the CSV file rversions.csv as releases.
  • Use str() to examine the structure of the date column. Notice it's already a Date object.
  • We've loaded anytime and created an object called sep_10_2009. Use the anytime() function to parse sep_10_2009.