extract_xts: Extracts time series data from grouping object.

Description Usage Arguments Value Examples

Description

If one of the groups in a groupr object is a date, then the object can be manipulated into an xts based groupr object. This is done by casting the date column against the unique values in the other grouping columns. A value column must be chosen in order to "fill in" the returned dataframe. The combination between the unique group values for the groups which aren't dates can result in many columns per resultant dataframe, so caution should be exercised when producing xts based groupr objects.

Usage

1
extract_xts(groupr, value_choice, date_column = "dd_dt")

Arguments

groupr

Grouping object created with groupr

value_choice

The column which will has values that will be in time series. The function cast from the reshape package is called to aggregate data. The function will be sum but each value should be unique when cast against the remaining groups.

date_column

The column with date data which will represent unique index for the returned xts

Value

An xts_groupr object with the date column cast against the groups column, using sum to summarize the value column

Examples

1
2
3
4
5
6
7
8
9
permits_groupr <- groupr(
  permits,
  groups = c("issued_month", "existing_const_type")
)
permits_xts <- extract_xts(
  permits_groupr,
  value_choice = "count",
  date_column = "issued_month"
)

athompson1991/groupR documentation built on May 10, 2019, 2:09 p.m.