Hi, and welcome.
I usually turn to Homebrew any time OSx is lacking in the compiler or library department. It will install in a location where you have write permissions and link as needed.
You'll find a fair amount of Apple I did it my way in
R packages that need compilation but fail with "Error: non-zero exit status." Often, for common packages, Saint Simon Urbanek on the Core R Team will make the required changes and upload a binary version that requires no user tears. If it's going to happen, it usually will within about a month of a new or updated release.
An alternative is to retry with
sudo since the directory is owned by root in the admin group.