subtract | R Documentation |

Subtract numerics from mondates.
When units = "months" and the `numeric`

is a whole number
the result has the same
day of the month subject to the number of days in the month,
thus abandoning `mondate`

's
approach of representing days as fractional months.
See examples.

```
subtract(e1, e2, units, forcelastday = FALSE)
```

`e1` |
a |

`e2` |
a |

`units` |
Anything allowed by |

`forcelastday` |
If FALSE, the result will have the same day of the month subject to
the numbere of days in the month.
If TRUE, the day of the month of the result will be the last day of the
month if |

A `mondate`

.

Dan Murphy.

```
x <- mondate(0:12)
subtract(x, 1) # The third date will the the 29th of March
x <- mondate.ymd(2013, 2:12, 15)
subtract(x, 1) # Always the 15th of the month. Compare to ...
x - 1
stopifnot(subtract(x, 1, units = "months") == mondate.ymd(2013, 1:11, 15))
```

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.