iddply: ddply with inequality constraints

Description Usage Arguments Value Examples

View source: R/iddply.R

Description

ddply with inequality constraints

Usage

1
2
3
4
5
6
iddply(data,
       equality.variables,
       lower.bound.variables,
       upper.bound.variables,
       norm.ball.variables,
       func)

Arguments

data

Data to process

equality.variables

Character vector of variables used to split data on equality

lower.bound.variables

Character vector of variables used to split data on lower bound inequalities

upper.bound.variables

Character vector of variables used to split data on upper bound inequalities

norm.ball.variables

Character vector of variables used to split data on norm ball inequalities

func

Function to call on each split-out subset of the data

Value

Data frame with results combined across splits

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
library('cumplyr')

data <- data.frame(Time = 1:5, Value = seq(1, 9, by = 2))

iddply(data,
       equality.variables = c('Time'),
       lower.bound.variables = c(),
       upper.bound.variables = c(),
       norm.ball.variables = list(),
       func = function (df) {with(df, mean(Value))})

iddply(data,
       equality.variables = c(),
       lower.bound.variables = c('Time'),
       upper.bound.variables = c(),
       norm.ball.variables = list(),
       func = function (df) {with(df, mean(Value))})

iddply(data,
       equality.variables = c(),
       lower.bound.variables = c(),
       upper.bound.variables = c('Time'),
       norm.ball.variables = list(),
       func = function (df) {with(df, mean(Value))})

iddply(data,
       equality.variables = c(),
       lower.bound.variables = c(),
       upper.bound.variables = c(),
       norm.ball.variables = list('Time' = 1),
       func = function (df) {with(df, mean(Value))})

iddply(data,
       equality.variables = c(),
       lower.bound.variables = c(),
       upper.bound.variables = c(),
       norm.ball.variables = list('Time' = 2),
       func = function (df) {with(df, mean(Value))})

iddply(data,
       equality.variables = c(),
       lower.bound.variables = c(),
       upper.bound.variables = c(),
       norm.ball.variables = list('Time' = 5),
       func = function (df) {with(df, mean(Value))})

johnmyleswhite/cumplyr documentation built on May 19, 2019, 5:17 p.m.