---
title: "Comment by Simona Jokubauskaite on \"Time Series Forecasting Lab (Part 2) - Feature Engineering with Recipes\" | Hashnode"
description: "Hi, one could capture.output from standardize_vec like this: stdout &lt; - capture.output(groups &lt; - lapply(X = 1 :length(Industries), FUN = function ( x ) {"
url: "https://hashnode.com/posts/time-series-forecasting-lab-part-2-feature-engineering-with-recipes/61d5c777e2f29f0805e13d7a/comment/61eec6d9c99aed184e7275c7"
---

[Discussion](https://hashnode.com/posts/time-series-forecasting-lab-part-2-feature-engineering-with-recipes/61d5c777e2f29f0805e13d7a)

Comment [Time Series Forecasting Lab (Part 2) - Feature Engineering with Recipes](https://hashnode.com/posts/time-series-forecasting-lab-part-2-feature-engineering-with-recipes/61d5c777e2f29f0805e13d7a)

[Simona Jokubauskaite](https://hashnode.com/@S1mona)

[Jan 24, 2022](https://hashnode.com/posts/time-series-forecasting-lab-part-2-feature-engineering-with-recipes/61d5c777e2f29f0805e13d7a/comment/61eec6d9c99aed184e7275c7)

**Hi, one could capture.output from standardize\_vec like this:**

```
stdout <- capture.output(groups <- lapply(X = 1:length(Industries), FUN = function(x){

  monthly_retail_tbl %>%
    filter(Industry == Industries[x]) %>%
    arrange(Month) %>%
    mutate(Turnover =  log1p(x = Turnover)) %>%
    mutate(Turnover =  standardize_vec(Turnover)) %>%
    future_frame(Month, .length_out = "12 months", .bind_data = TRUE) %>%
    mutate(Industry = Industries[x]) %>%
    tk_augment_fourier(.date_var = Month, .periods = 12, .K = 1) %>%
    tk_augment_lags(.value = Turnover, .lags = 12) %>%
    tk_augment_slidify(.value   = Turnover_lag12,
                       .f       = ~ mean(.x, na.rm = TRUE), 
                       .period  = c(3, 6, 9, 12),
                       .partial = TRUE,
                       .align   = "center")
}), type = "message")
```

**And save mean and sd values automatically:**

```
collect_vals <- function(stdout, string = "mean: "){
  stdout %>% grep(string, ., value = TRUE) %>% gsub(string,"", .) %>% as.numeric()
}
std_mean <- stdout %>% collect_vals("mean: ")
std_sd <- stdout %>% collect_vals("standard deviation: ")
```

[Boris Guarisma](https://hashnode.com/@bguarisma)

[Jan 24, 2022](https://hashnode.com/posts/time-series-forecasting-lab-part-2-feature-engineering-with-recipes/61d5c777e2f29f0805e13d7a/comment/61eec6d9c99aed184e7275c7#reply-61eedeb7c99aed184e727948)

Thank you [Simona Jokubauskaite](https://hashnode.com/@S1mona) ! I will update by referring the reader to your comment
