Description Usage Arguments Examples

View source: R/create_series.R

[create_series()] allows the user to quickly create a 'tbl_time' object with a 'date' column populated with a sequence of dates.

1 2 | ```
create_series(time_formula, period = "daily", class = "POSIXct",
include_end = FALSE, tz = "UTC", as_vector = FALSE)
``` |

`time_formula` |
A period to create the series over. This is specified as a formula. See the 'Details' section of [time_filter()] for more information. |

`period` |
A formula or character specification used for time-based grouping. If a formula, e.g. '1~year', the formula is split and parsed to form the grouping period. The 'period' argument accepts a formula of the form 'multiple ~ period' allowing for flexible period grouping. The following are examples: * 1 Year: '1~y' * 3 Months: '3~m' * 90 Days: '90~d' Note that while shorthand is used above, an attempt is made to recognize more explicit period names such as: * 2 Year: '2~year' / '2~years' / '2~yearly' The 'period' argument also accepts characters that are converted to their corresponding periods. The following are accepted: * '"yearly"' or '"y"' * '"quarterly"' or '"q"' * '"monthly"' or '"m"' * '"weekly"' or '"w"' * '"daily"' or '"d"' * '"hour"' or '"h"' * '"minute"' or '"M"' * '"second"' or '"s"' |

`include_end` |
Whether to always include the RHS of the 'time_formula' even if it does not match the regularly spaced index. |

`tz` |
Time zone of the new series. |

`force_class` |
Either '"Date"' or '"POSIXct"'. The default is to infer the simplest class required from the 'period' specified, but this will override that. |

`as_date_vector` |
Should the series be returned as a vector instead of a tibble? |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
# Every day in 2013
create_series(~2013, "daily")
# Every other day in 2013
create_series(~2013, 2~d)
# Every quarter in 2013
create_series(~2013, 1~q)
# Daily series for 2 years
create_series(2013~2015, 1~d)
# Minute series for 2 months
create_series(2012-01~2012-02, 1~M)
# Second series for 2 minutes
create_series(2011-01-01 + 12:10:00 ~ 2011-01-01 + 12:12:00, 1~s)
# Force POSIXct class
create_series(~2013, 1~d, force_class = "POSIXct")
``` |

DavisVaughan/tibbletime3 documentation built on Nov. 23, 2017, 5: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.