I have tried to install R-Studio from beginning: Some times the "raster" package cannot be installed. In this case, you need to do as follows
1. Install Rtools from this file
2. Install "terra" and "raster" package (as shown in the attached figure):
With RStudio click "Install => type "terra" in the "Packages" text box.
Do similar for installing the "raster"package