Cannot install many R packages on Mac 10.13.6. Please help!

Hi, and welcome!

This is an example of the recurring problem that drove me to abandon MAC OS for Linux.

The key output is

checking whether the C compiler works... no
...
configure: error: C compiler cannot create executables

Translation: The package required compilation (many packages have been converted to binary by Saint Simon Urbanek of the R Core Team, and the tedious work of modifying the source code to play nice with Apple has been bestowed upon the laity).

Some packages will successfully compile, however. To do that you need two installations: XCode from the AppStore and the related command line tools, by running the following command in the terminal:

xcode-select --install

If that doesn't work, the next step is a Homebrew gcc install, but be sure to get familiar with that package manager first.