End of Summer - hours only!Up to 80% off on all courses and bundles.-Close


Nice. We can also select some nonobvious information, like weekdays, which provides the day of the week (including Saturday and Sunday). Simply use the wday() function:

trucks$departure_weekday <- wday(trucks$departure_date)


Use the wday() function on the departure_date column in the ships data set to create a new column, departure_weekday.

As you will see, this function returns a number between 1 and 7: 1 for Sunday, 2 for Monday, etc.