A great resource that covers is the Shiny debugging and reprex guide.
On package installation fails with the error message,
... is not writable
It often means you don't have permissions to write to the directory R is trying to install the package. That is, you must try to install this package as administrator.
One solution is, You can create a library directory where you have write-permission then direct R to install all packages to it. See the following link for example
https://csgillespie.github.io/efficientR/3-3-r-startup.html#renviron