Learn R Programming

saeSim (version 0.11.0)

sim_agg: Aggregation component

Description

One of the components which can be added to a simulation set-up. Aggregating the data is a simulation component which can be used to aggregate the population or sample. The aggregation will simply be done after the sampling, if you haven't specified any sampling component, the population is aggregated (makes sense if you draw samples directly from the model).

Usage

sim_agg(simSetup, aggFun = agg_all())

Arguments

simSetup

a sim_setup.

aggFun

function which controls the aggregation process. At the moment only agg_all is defined.

Details

Potentially you can define an aggFun yourself. Take care that it only has one argument, named dat, and returns the aggregated data as data.frame.

See Also

agg_all, sim_gen, sim_comp_pop, sim_sample, , sim_comp_sample

Examples

Run this code
# NOT RUN {
# Aggregating the population:
sim_base_lm() %>% sim_agg()

# Aggregating after sampling:
sim_base_lm() %>% sim_sample() %>% sim_agg()

# User aggFun:
sim_base_lm() %>% sim_agg(function(dat) dat[1, ])
# }

Run the code above in your browser using DataLab