0

The behavior of map is understood to the extent of the following code.

iris %>% 
  group_nest(Species) %>% 
  mutate(lm_mod = map(data,function(x){
    lm(Sepal.Width~Sepal.Length,x)
    }))

The above code works in my head as follows.

fot(i in unique(iris$species))
  data <- slice iris$species[i]
  function(data){lm(width ~ length,data)}
  lm_mod[i] <- function(data)

But I'm confused when I encounter new code.

folds %>%
  mutate(recipes = map(splits, prepper, recipe = recipe_code))

in my head

for(i in len(folds))
  folds$recipes <- prepper(splits) ??recipe = recipe_code??

Where does the recipe_code go in?

h-y-jp
  • 199
  • 1
  • 8
  • It translates roughly to `for(i in seq_along(folds$splits)) folds$recipes[[i]] <- prepper(folds$splits[[i]], recipe = recipe_code)` – Aurèle Oct 21 '20 at 07:57
  • The relevant part of the documentation is the description of the `...` argument in the help page `?map`: `...` Additional arguments passed on to the mapped function. – Aurèle Oct 21 '20 at 07:59

0 Answers0