-
Notifications
You must be signed in to change notification settings - Fork 12
/
tidy_step.Rd
38 lines (32 loc) · 867 Bytes
/
tidy_step.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tidy_step.R
\name{tidy_step}
\alias{tidy_step}
\title{Convert a step to a tidy function for use in a design}
\usage{
tidy_step(...)
}
\arguments{
\item{...}{A function of data and other arguments that returns data}
}
\value{
A function that takes only data compatible with creating a design
}
\description{
Wrap a data-in, data-out function call as a tidy function
}
\examples{
# With dplyr verbs like mutate
library(dplyr)
my_population <- declare_population(N = 10)
a_wrapped_mutate <- tidy_step(mutate(q = 5))
my_design <- my_population + a_wrapped_mutate
my_design
# With user-written functions
my_function <- function(data, my_mean) {
data$new_variable <- rnorm(n = nrow(data), mean = my_mean)
data
}
my_design <- my_population + tidy_step(my_function(my_mean = 5))
my_design
}