Open EmilHvitfeldt opened 1 year ago
Do something like this:
library(tidyverse) tb <- tibble(c1 = rnorm(10), c2 = rnorm(10, 2), c3 = rnorm(10, 3), d1 = rnorm(10,6)) tb %>% rowwise() %>% mutate(sd = sd(c_across(starts_with("c")))) #> # A tibble: 10 × 5 #> # Rowwise: #> c1 c2 c3 d1 sd #> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1.59 0.864 3.75 6.06 1.50 #> 2 1.57 3.15 2.89 7.21 0.851 #> 3 1.42 2.23 1.40 5.17 0.474 #> 4 1.71 2.57 3.50 7.66 0.897 #> 5 1.24 1.82 3.07 5.77 0.937 #> 6 1.03 0.599 2.49 6.18 0.991 #> 7 -1.26 0.291 4.06 6.25 2.74 #> 8 -0.500 1.45 2.55 4.84 1.54 #> 9 -0.195 1.20 3.89 5.59 2.08 #> 10 -0.216 1.20 4.25 6.63 2.28
Based on https://github.com/tidymodels/recipes/issues/949
Do something like this:
Based on https://github.com/tidymodels/recipes/issues/949