R: package loading order problem (solved with conflicted)

Hi all,

Maybe it was mentioned before, I got a weird bug on a submission. Everything was great when I ran it locally but it crashed during submission.

It seems that the packages are not necessary loaded in the order specified on model.R.

In my case, it caused a problem since the stats package was loaded last (which is odd since I did not use it). Anyway, that meant that stats::filter: masked dplyr::filter which was not what I wanted…

The solution is the package conflicted.

To be sure that this kind of problem don’t happen, load all your packages, run conflicted::conflict_scout() and add steps like conflicted::conflict_prefer("filter", "dplyr").

I mean, we should do it on every projects, but in this case, it is particularly useful.

Hope this helps.