You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
impute_missing_recipe <- recipe(Class ~ ., data = missing_cancer)
1353
+
impute_missing_recipe <- impute_missing_recipe |>
1354
+
step_impute_mean(all_predictors())
1355
+
prep()
1356
+
impute_missing_recipe
1357
+
```
1358
+
1359
+
```{r 05-impute-print, echo=FALSE}
1360
+
hidden_print_cli(impute_missing_recipe)
1361
+
```
1362
+
1363
+
Applying the recipe to the `missing_cancer` data frame fills in the missing entries with the mean values of their corresponding variables.
1364
+
1365
+
```{r 05-impute-bake}
1366
+
imputed_cancer <- bake(impute_missing_recipe, data = missing_cancer)
1367
+
imputed_cancer
1368
+
```
1369
+
1370
+
However you decide to handle missing data in your data analysis, it is always crucial to think critically about
1371
+
the setting, how the data were collected, and the question you are answering.
1372
+
1373
+
1297
1374
## Putting it together in a `workflow` {#puttingittogetherworkflow}
1298
1375
1299
-
The `tidymodels` package collection also provides the `workflow`, a way to chain\index{tidymodels!workflow}\index{workflow|see{tidymodels}} together multiple data analysis steps without a lot of otherwise necessary code for intermediate steps.
1300
-
To illustrate the whole pipeline, let's start from scratch with the `unscaled_wdbc.csv` data.
1301
-
First we will load the data, create a model, and specify a recipe for how the data should be preprocessed:
1376
+
The `tidymodels` package collection also provides the `workflow`, a way to
1377
+
chain\index{tidymodels!workflow}\index{workflow|see{tidymodels}} together
1378
+
multiple data analysis steps without a lot of otherwise necessary code for
1379
+
intermediate steps. To illustrate the whole pipeline, let's start from scratch
1380
+
with the `unscaled_wdbc.csv` data. First we will load the data, create a
1381
+
model, and specify a recipe for how the data should be preprocessed:
0 commit comments