# Define mutate branches.
hurricane_strength <- mutate_branch(
# damage vs. wind speed vs.pressure
NDAM,
HighestWindSpeed,
Minpressure_Updated_2014,
# Standardized versions
scale(NDAM),
scale(HighestWindSpeed),
-scale(Minpressure_Updated_2014),
)
y <- mutate_branch(
alldeaths, log(alldeaths + 1)
)
# Create a mverse and add the branches.
mv <- create_multiverse(hurricane) %>%
add_mutate_branch(hurricane_strength, y)
execute_multiverse(mv)
# Extract all branched columns from all universes
extract(mv)
# Specify the columns to extract from each universe using columns
# You can select both branched and non-branched columns
extract(mv, columns = c("hurricane_strength", "NDAM"))
# Specify the universe to extract from using universe
extract(mv, universe = 1)
# Specify the number of universes to extract from using nuni
# The universes are randomly selected
extract(mv, nuni = 3)
# Specify the proportion of data to extract from each universe using
# frow. The rows are randomly selected
extract(mv, frow = 0.7)
Run the code above in your browser using DataLab