Hi, and welcome!
Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. This answer isn't coding related and the error dump tells it all.
On macOS, packages sometimes fail to install, often with a non-zero exit status message. This is due to Apple's idiosyncratic compiler. The same packages will install on most Linux systems without trouble. Saint Simon Urbanek of the R Core Development Team
takes on the brain damage required to recode the source to get around macOS's peculiar worldview for those in CRAN, but he can't bestow the same mercy on those still in development.
Some packages will successfully install through compilation from source, but many won't.
When installing if you are offered the option to install from source, it makes sense to try it once. But, if at first it doesn't succeed, in all likelihood it never will. It's usually only 7-10 days until a macOS binary is available
So, the moral of the story is to try y the first time, but if you get the non-zero exit status
raspberry, just say no the next time.