Learn R Programming

tidysynthesis (version 0.1.2)

presynth: Create a presynth object

Description

Create a presynth object

Usage

presynth(roadmap, synth_spec)

Value

A presynth object.

Arguments

roadmap

A roadmap object from roadmap().

synth_spec

A synth_spec object from synth_spec().

Examples

Run this code

# create roadmap
rm <- roadmap(
  conf_data = acs_conf_nw,
  start_data = acs_start_nw
) 

rpart_mod_reg <- parsnip::decision_tree() |>
  parsnip::set_engine(engine = "rpart") |>
  parsnip::set_mode(mode = "regression")

rpart_mod_class <- parsnip::decision_tree() |>
  parsnip::set_engine(engine = "rpart") |>
  parsnip::set_mode(mode = "classification")

synth_spec1 <- synth_spec(
  default_regression_model = rpart_mod_reg,
  default_regression_sampler = sample_rpart,
  default_classification_model = rpart_mod_class,
  default_classification_sampler = sample_rpart
)

# create a presynth object
# use defaults for noise, constraints, and replicates
presynth(
  roadmap = rm,
  synth_spec = synth_spec1
)

Run the code above in your browser using DataLab