Make sure that you have installed the most recent version of R on your computer. If not, go to https://cran.r-project.org/ and download the latest version adequate for your operating system and follow the instructions for the installation. The default settings are just fine.
When installing R, it is important to run it as administrator (right-click on the Setup icon). Otherwise, you may encounter problems with the access to folders and having permissions to conduct specific tasks.
Take a look at the following screenshot for better understanding: