Please see the FAQ: What's a reproducible example (`reprex`) and how do I create one? Using a reprex, complete with representative data will attract quicker and more answers.
The first thing to look at is at the end
could not find function "%>%
which means magrittr
isn't in namespace