inflate_: Inflate a data frame

Description Usage Arguments S3 generic Examples

View source: R/inflate.R

Description

Inflate a data frame

Usage

1
inflate_(data, var, domain = NULL)

Arguments

data(data.frame)

A data frame to inflate

var(string)

Column name specifying column to inflate over. The column should be of class Date.

domain(Date)

A vector of two dates (or two strings that can be coerced to dates). Used to specifiy the range to inflate over. The first date should specify the lower bound of the date range; the second date should specify the upper bound of the date range. If NULL the range is inferred by taking the minumum and maximum dates in the column.

S3 generic

This function has methods for:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(dplyr)

sales_data <- data_frame(
  date = as.Date(c("2014-01-01", "2014-01-03")),
  sales = c(10, 13)
)

inflate_(sales_data, "date")
inflate_(sales_data, "date", domain = c("2013-12-31", "2014-01-04"))

grp_sales_data <- data_frame(
  group = c("a", "a", "b", "b"),
  date = as.Date(c("2014-01-01", "2014-01-03", "2014-01-01", "2014-01-03")),
  sales = c(10, 13, 20, 30)
)

grp_sales_data %>%
  group_by(group) %>%
  inflate_("date")

Mullefa/inflate documentation built on May 7, 2019, 5:12 p.m.