I'm trying to add ggplot2 package using rsudio console.
I got the following message :
install.packages("ggplot2")
Installation du package dans ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/ggplot2_3.3.5.tar.gz'
Content type 'application/x-gzip' length 3063309 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Erreur : le package ‘gtable’ a été installé avant R 4.0.0 : veuillez le réinstaller, s'il-vous-plait
Exécution arrêtée
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpliCdtG/downloaded_packages’
I can't install any package.
How can I solve this problem ?
install.packages("gtable")
Installation du package dans ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/gtable_0.3.0.tar.gz'
Content type 'application/x-gzip' length 368081 bytes (359 KB)
==================================================
downloaded 359 KB
* installing *source* package ‘gtable’ ...
** package ‘gtable’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (gtable)
The downloaded source packages are in
‘/tmp/RtmpN1HUFD/downloaded_packages’
install.packages("ggplot2")
Installation du package dans ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/ggplot2_3.3.5.tar.gz'
Content type 'application/x-gzip' length 3063309 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Erreur : le package ‘rlang’ a été installé avant R 4.0.0 : veuillez le réinstaller, s'il-vous-plait
Exécution arrêtée
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpN1HUFD/downloaded_packages’
I'm not sure what level of explanation would help you the most. Simply put, advanced packages often rely on other packages to provide their function. Normally when you install such a package, the packages on which it depends are identified and installed as you need them. You can get into trouble though, if you have previously installed versions of packages that are not now the ones you need. Hence this pattern of reinstalling the dependencies in a manual fashion, until you are ready to install the package that is your goal.
To continue following this pattern do as we have done. having installed gtable and rlang,.. now try again to install your goal package, and watch for messages.
(or update all your packages at once and then try your goal - update.packages)
(or use a package manager that can do a lot for you, like renv)