The newest versions of R packages are often available only as source code. When you install or update the package, it may indicate it needs compilation. To enable your computer to compile the code in these packages, you need to do a small amount of additional setup. Before you start, make sure R is closed. I recommend rebooting after installing, as well, but it is not a requirement.
On a Mac, you only need to install Xcode Command Line Tools. This is simple:
You will probably need to provide your password to enable installing the software.
Follow any onscreen instructions and wait for it to finish.
On a PC, you need to obtain a toolchain for compiling. The easiest way to do this is with RTools:
Download the newest Rtools installer.
Run the file to install, following all onscreen instructions. If you are unsure about anything, leave the default settings.
You can now compile R packages!
Compiling code is complicated and sometimes errors specific to your machine will arise even if you followed everything above correctly. Reach out if you have issues!