# \donttest{
library(dplyr)
M <- multiverse()
inside(M, {
data <- rnorm(100, 50, 20)
x.mean <- mean(data, trim = branch(
trim_values,
"trim_none" ~ 0,
"trim_1pc" ~ 0.05,
"trim_5pc" ~ 0.025,
"trim_10pc" ~ 0.05
))
y <- sd(data)
})
# Extracts the relevant variable from the multiverse
M %>%
extract_variables(x.mean)
# if you want to filter the multiverse before extracting variables from it
# you ca first create the table and manipulate it before extracting variables
expand(M) %>%
extract_variables(x.mean)
# you can extract more than one variable from the multiverse simultaneously
# these variables will be new columns in the dataset
expand(M) %>%
extract_variables(x.mean, y)
# }
Run the code above in your browser using DataLab