Session Ready
Exercise

Adding useful labels

In the previous exercise you found the month of releases:

head(month(release_time))

and received numeric months in return. Sometimes it's nicer (especially for plotting or tables) to have named months. Both the month() and wday() (day of the week) functions have additional arguments label and abbr to achieve just that. Set label = TRUE to have the output labelled with month (or weekday) names, and abbr = FALSE for those names to be written in full rather than abbreviated.

For example, try running:

head(month(release_time, label = TRUE, abbr = FALSE))

Practice by examining the popular days of the week for R releases.

Instructions
100 XP

releases is now a data frame with a column called datetime with the release time.

  • First, see what wday() does without labeling, by calling it on the datetime column of releases and tabulating the result. Do you know if 1 is Sunday or Monday?
  • Repeat above, but now use labels by specifying the label argument. Better, right?
  • Now store the labelled weekdays in a new column called wday.
  • Create a barchart of releases by weekday, facetted by the type of release.