Learn R Programming

cumplyr (version 0.1-1)

iddply: ddply with inequality constraints

Description

ddply with inequality constraints

Usage

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

Run this code
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))})

Run the code above in your browser using DataLab