simulate_process {edibble}R Documentation

Simulation process

Description

This function to create and store functions to simulate the records.

Usage

simulate_process(.data, ...)

Arguments

.data

An edibble table.

...

A name-value pair where the name should correspond to either the record name that you are simulating or a process name if the return object is a data frame with columns corresponding to the name of the records. The value must be a function with set default arguments. The return object of this function should be either a vector or a data frame with the column names corresponding to the record names. The size should correspond to the number of columns.

Details

When creating a function, internally you can refer to any of the factors without referring to the actual data. The data referred to is expected to be from the full data. Like in tidyverse, syntax .data is reserved for the full data and .env can be used to refer to environment variables.

You can use the syntax n() to refer to nrow(.data) or n(fct) where fct corresponds to unquoted factor name. The return value will be the number of the observed number of levels of factor fct in the data. For n(fct1, fct2) it will return the observed number of distinct interaction levels for fct1 and fct2.

Note that you can actually put as many process as you like if you use a process name (starting with a dot), even if this is for the same record factor.


[Package edibble version 1.1.1 Index]