Created
April 15, 2021 15:51
-
-
Save DavisVaughan/dc0fa718704900c857550b219b2e2d13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(recipes) | |
library(butcher) | |
library(rlang) | |
my_function2 <- function() { | |
a <- iris | |
b <- iris | |
c <- iris | |
rec <- | |
recipe(Species ~ ., data = iris) %>% | |
step_normalize(all_numeric()) %>% | |
step_pca(all_numeric()) %>% | |
prep() | |
rec <- butcher(rec) | |
rec | |
} | |
x <- my_function2() | |
x | |
#> Data Recipe | |
#> | |
#> Inputs: | |
#> | |
#> role #variables | |
#> outcome 1 | |
#> predictor 4 | |
#> | |
#> Training data contained 150 data points and no missing data. | |
#> | |
#> Operations: | |
#> | |
#> Centering and scaling for Sepal.Length, Sepal.Width, ... [trained] | |
#> PCA extraction with Sepal.Length, Sepal.Width, ... [trained] | |
quo <- x$steps[[1]]$terms[[1]] | |
quo | |
#> <quosure> | |
#> expr: ^all_numeric() | |
#> env: 0x7fd13a3ebe60 | |
env <- quo_get_env(quo) | |
env_parent <- rlang::env_parent(env) | |
head(env_parent$a) | |
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species | |
#> 1 5.1 3.5 1.4 0.2 setosa | |
#> 2 4.9 3.0 1.4 0.2 setosa | |
#> 3 4.7 3.2 1.3 0.2 setosa | |
#> 4 4.6 3.1 1.5 0.2 setosa | |
#> 5 5.0 3.6 1.4 0.2 setosa | |
#> 6 5.4 3.9 1.7 0.4 setosa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment