0

Whenever I try to load ggplot the following error comes:

Error: package or namespace load failed for ‘ggplot2’: package ‘scales’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version

Tung
  • 26,371
  • 7
  • 91
  • 115
  • 1
    Can you add the results of `sessionInfo()` to your question please – user20650 Jan 06 '19 at 13:41
  • 2
    Have you reinstalled `scales`? What are the versions of `R`, `ggplot2` and `scales`? As suggested please add `sessionInfo()` – NelsonGon Jan 06 '19 at 13:45
  • > sessionsinfo() Error in sessionsinfo() : could not find function "sessionsinfo" Warning: unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES' Warning: unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES' > sessioninfo() Error in sessioninfo() : could not find function "sessioninfo" – Taimur Khan Jan 06 '19 at 15:18
  • I am new to R, so what are scales. my R version is 3.5.2 and studio version is 1.1.463, ggplot2 version is 3.1.0...How to check scales and what is it? – Taimur Khan Jan 06 '19 at 15:26
  • 1
    @TaimurKhan ; R is case sensitive and functions need to be spelled correctly -- you need to use `sessionInfo()` – user20650 Jan 06 '19 at 15:35
  • R version 3.5.2 (2018-12-20) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7600) Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.5.2 tools_3.5.2 gtable_0.2.0 yaml_2.2.0 grid_3.5.2 – Taimur Khan Jan 06 '19 at 15:37
  • @TaimurKhan: Restart R or RStudio, then run this line `update.packages(checkBuilt = TRUE, ask = FALSE, repos = "https://cran.rstudio.com")` – Tung Jan 06 '19 at 15:38
  • After that, run `install.packages("ggplot2", dependencies = TRUE)` – Tung Jan 06 '19 at 15:38
  • upon entering the first command:update.packages this error comes: Warning: unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES' – Taimur Khan Jan 06 '19 at 15:41
  • Remove the `repos = ...` part then try again – Tung Jan 06 '19 at 15:42
  • You might need RTools. If so, follow [this](https://stackoverflow.com/a/50278862/786542) – Tung Jan 06 '19 at 15:44
  • @TaimurKhan: Relevant https://support.rstudio.com/hc/en-us/community/posts/115005709447-Can-t-install-package- & https://support.rstudio.com/hc/en-us/community/posts/205198138-packages-installation-problem – Tung Jan 06 '19 at 15:51

0 Answers0