Description Usage Arguments Details Value Author(s) Examples

Extract index values of a given `xts`

object corresponding
to the *last* observations given a period specified by `on`

1 | ```
endpoints(x, on="months", k=1)
``` |

`x` |
an xts object |

`on` |
the periods endpoints to find as a character string |

`k` |
along every k-th element - see notes |

`endpoints`

returns a numeric vector corresponding to the
*last* observation in each period specified by `on`

, with a
zero added to the beginning of the vector, and the index of the last
observation in `x`

at the end.

Valid values for the argument `on`

include: “us” (microseconds),
“microseconds”, “ms” (milliseconds),
“milliseconds”, “secs” (seconds),
“seconds”, “mins” (minutes), “minutes”,
“hours”, “days”, “weeks”, “months”, “quarters”,
and “years”.

A numeric vector of endpoints beginning with 0 and ending with the a value equal to the length of the x argument.

Jeffrey A. Ryan

1 2 3 4 | ```
data(sample_matrix)
endpoints(sample_matrix)
endpoints(sample_matrix, 'weeks')
``` |

```
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
[1] 0 30 58 89 119 150 180
[1] 0 6 13 20 27 34 41 48 55 62 69 76 83 90 97 104 111 118 125
[20] 132 139 146 153 160 167 174 180
```

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.