Description Usage Arguments Details Value Author(s) References See Also Examples

Functions for computing a specifed day-of-week, such as ‘the last Friday of October 2015’.

1 2 3 | ```
last_weekday(weekday, x, shift = 0L,
period = "month", before, inclusive = TRUE)
nth_weekday(weekday, x, n = 1L)
``` |

`x` |
a vector of class |

`shift` |
a vector of integers |

`weekday` |
an integer ( |

`period` |
character. Currently ignored. |

`before` |
a |

`inclusive` |
logical. Is |

`n` |
an integer |

`last_weekday`

computes the last day-of-the-week
(specified as an integer 0 to 6, with Sunday being 0)
in a given month, e.g. ‘the last Friday’.
`shift`

moves forward (when positive) or
backward (when negative) by one week; see Examples.

`nth_weekday`

gives the *n*-th
day-of-the-week (specified as an integer 0 to 6, with
Sunday being 0) of a given month, e.g. ‘the
second Monday’.

`Date`

Enrico Schumann

B.D. Ripley and K. Hornik. *Date-Time Classes*. R-News,
**1**(2):8–12, 2001.

Many useful functions are also in package chron.

1 2 3 4 5 6 7 | ```
## GOAL: find the third Friday in March 2013
## SOLUTION: find the last Friday in February 2013 and
## shift forward by 3 weeks
last_weekday(5, as.Date("2013-02-01"), shift = 3)
## ... or much simpler
nth_weekday(5, as.Date("2013-03-01"), 3)
``` |

datetimeutils documentation built on March 18, 2018, 2:30 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.