0

I have these two bits of code that need to run, and Im trying to figure out what's the optimal way. So far, Iv'e only been able to benchmark the for loop. Also, differently from the examples I saw online, I cannot see the objects bnch_loop and bnch_future created in my code..

Any thoughts?

bnch_loop<-bench::mark(
for (i in 1:16) {
  nested_inter$model[[i]]<- nb_thesis_inter(df= nested_nb$data[[i]], mdl= nested_nb$model[[i]])
})


plan(multisession, workers = 8)
bnch_future<-bench::mark(
nested_inter$model2 = future_Map(nb_thesis_inter,
                                nested_nb$data,
                                nested_nb$model))
Stat.Enthus
  • 335
  • 1
  • 12
  • 1
    Put ```{}``` around the ```future_Map``` call. Multi-line statements fail without curly brackets. Maybe parentheses but I never have tried that – Cole Oct 17 '20 at 19:05
  • 1
    What examples are you following online? How exactly are you running this? Why do you mean when you say you can't "see" `bnch_loop`? It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Oct 17 '20 at 19:07
  • Thanks. I usually try to make fully reproducible but sometime can't share the data. The Brackets worked! In terms of bnch_loop , I thought it was going to create a new df with the model of the benchmarks.. – Stat.Enthus Oct 17 '20 at 20:10

0 Answers0