aggregate_impute: Aggregate an imputed dataset

Description Usage Arguments Examples

Description

Aggregate an imputed dataset

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
aggregate_impute(object, grouping, fun, filter, join)

## S4 method for signature 'ANY'
aggregate_impute(object, grouping, fun, filter, join)

## S4 method for signature 'rawImputed'
aggregate_impute(object, grouping, fun, filter,
  join)

## S4 method for signature 'aggregatedImputed'
aggregate_impute(object, grouping, fun,
  filter, join)

Arguments

object

a rawImputed object

grouping

a vector of variables names to group the aggregation on

fun

the function to aggregate

filter

an optional argument to filter the raw dataset before aggregation. Will be passed to the .dots argument of filter_

join

an optional argument to filter the raw dataset based on a data.frame. A semi_join will be applied with join or each element of join in case join is a list

Examples

1
2
3
4
5
dataset <- generateData(n.year = 10, n.site = 50, n.run = 1)
dataset$Count[sample(nrow(dataset), 50)] <- NA
model <- lm(Count ~ Year + factor(Period) + factor(Site), data = dataset)
imputed <- impute(data = dataset, model = model)
aggregate_impute(imputed, grouping = c("Year", "Period"), fun = sum)

inbo/multimput documentation built on Dec. 16, 2019, 6:04 p.m.