'Error Message when trying to install ggplot2 package in R studio: STRING_ELT() can only be applied to a 'character vector', not a 'NULL'

I am trying to install the ggplot2 package in R. When I enter install.packages('ggplot2') in the Console I get the following message :

Error in install.packages : STRING_ELT() can only be applied to a 'character vector', not a 'NULL'

I'm stuck, any help anyone can provide would be much appreciated.

OS is : Microsoft Windows 10 Education (Version 10.0.19043)
R version is : R-3.2.2 ([64-bit]
ggplot2 version is : ggplot2_3.3.5



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source