I am unable to install library(raster) getting error Error: unexpected '==' in "=="

Sorry but I don't see how this is relevant to your original question, this does not seem to have anything to do with package installation issues but with a syntax error in your code, sadly I'm not able to eyeball it.

To help us help you, could you please turn this into a proper reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one: