R或Rstudio中突然不能成功加载(library)ggplot包或其他包,不存在叫colorspace的这个包,如何解决?

问题:如果R包(ggplot或pheatmap等)可以安装成功(install.packags),但却不能成功加载(library),且显示不存在叫‘colorspace’这个名字的程辑包
安装成功,加载失败
解决方法:安装colorspace包即可。代码:install.packages(‘colorspace’, depend=TRUE)

具体如下:

install.packages(“ggplot2”,repos=“http://mirrors.tuna.tsinghua.edu.cn/CRAN/”)

trying URL ‘http://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/ggplot2_3.2.1.zip’
Content type ‘application/zip’ length 3959380 bytes (3.8 MB)
downloaded 3.8 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Administrator\AppData\Local\Temp\RtmpWme7aH\downloaded_packages

library(‘ggplot2’)

Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
不存在叫‘colorspace’这个名字的程辑包
In addition: Warning message:
程辑包‘ggplot2’是用R版本3.5.3 来建造的

install.packages(‘colorspace’, depend=TRUE)

also installing the dependencies ‘zoo’, ‘lmtest’, ‘httpuv’, ‘sourcetools’, ‘later’, ‘promises’, ‘tidyselect’, ‘tinytex’, ‘kernlab’, ‘mvtnorm’, ‘vcd’, ‘shiny’, ‘shinyjs’, ‘dplyr’, ‘png’, ‘jpeg’, ‘rmarkdown’, ‘rcartocolor’, ‘scico’, ‘wesanderson’

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/zoo_1.8-6.zip’
Content type ‘application/zip’ length 1098920 bytes (1.0 MB)
downloaded 1.0 MB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/lmtest_0.9-37.zip’
Content type ‘application/zip’ length 361358 bytes (352 KB)
downloaded 352 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/httpuv_1.5.1.zip’
Content type ‘application/zip’ length 1492197 bytes (1.4 MB)
downloaded 1.4 MB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/sourcetools_0.1.7.zip’
Content type ‘application/zip’ length 530457 bytes (518 KB)
downloaded 518 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/later_0.8.0.zip’
Content type ‘application/zip’ length 611005 bytes (596 KB)
downloaded 596 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/promises_1.0.1.zip’
Content type ‘application/zip’ length 695048 bytes (678 KB)
downloaded 678 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/tidyselect_0.2.5.zip’
Content type ‘application/zip’ length 625615 bytes (610 KB)
downloaded 610 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/tinytex_0.15.zip’
Content type ‘application/zip’ length 97902 bytes (95 KB)
downloaded 95 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/kernlab_0.9-27.zip’
Content type ‘application/zip’ length 2659503 bytes (2.5 MB)
downloaded 2.5 MB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/mvtnorm_1.0-11.zip’
Content type ‘application/zip’ length 271076 bytes (264 KB)
downloaded 264 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/vcd_1.4-4.zip’
Content type ‘application/zip’ length 1554607 bytes (1.5 MB)
downloaded 1.5 MB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/shiny_1.3.2.zip’
Content type ‘application/zip’ length 4672404 bytes (4.5 MB)
downloaded 4.5 MB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/shinyjs_1.0.zip’
Content type ‘application/zip’ length 1035230 bytes (1010 KB)
downloaded 1010 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/dplyr_0.8.3.zip’
Content type ‘application/zip’ length 3255186 bytes (3.1 MB)
downloaded 3.1 MB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/png_0.1-7.zip’
Content type ‘application/zip’ length 292639 bytes (285 KB)
downloaded 285 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/jpeg_0.1-8.zip’
Content type ‘application/zip’ length 230449 bytes (225 KB)
downloaded 225 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/rmarkdown_1.15.zip’
Content type ‘application/zip’ length 3588864 bytes (3.4 MB)
downloaded 3.4 MB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/rcartocolor_2.0.0.zip’
Content type ‘application/zip’ length 562818 bytes (549 KB)
downloaded 549 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/scico_1.1.0.zip’
Content type ‘application/zip’ length 230467 bytes (225 KB)
downloaded 225 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/wesanderson_0.3.6.zip’
Content type ‘application/zip’ length 21258 bytes (20 KB)
downloaded 20 KB

trying URL ‘https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.5/colorspace_1.4-1.zip’
Content type ‘application/zip’ length 2548791 bytes (2.4 MB)
downloaded 2.4 MB

package ‘zoo’ successfully unpacked and MD5 sums checked
package ‘lmtest’ successfully unpacked and MD5 sums checked
package ‘httpuv’ successfully unpacked and MD5 sums checked
package ‘sourcetools’ successfully unpacked and MD5 sums checked
package ‘later’ successfully unpacked and MD5 sums checked
package ‘promises’ successfully unpacked and MD5 sums checked
package ‘tidyselect’ successfully unpacked and MD5 sums checked
package ‘tinytex’ successfully unpacked and MD5 sums checked
package ‘kernlab’ successfully unpacked and MD5 sums checked
package ‘mvtnorm’ successfully unpacked and MD5 sums checked
package ‘vcd’ successfully unpacked and MD5 sums checked
package ‘shiny’ successfully unpacked and MD5 sums checked
package ‘shinyjs’ successfully unpacked and MD5 sums checked
package ‘dplyr’ successfully unpacked and MD5 sums checked
package ‘png’ successfully unpacked and MD5 sums checked
package ‘jpeg’ successfully unpacked and MD5 sums checked
package ‘rmarkdown’ successfully unpacked and MD5 sums checked
package ‘rcartocolor’ successfully unpacked and MD5 sums checked
package ‘scico’ successfully unpacked and MD5 sums checked
package ‘wesanderson’ successfully unpacked and MD5 sums checked
package ‘colorspace’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\Administrator\AppData\Local\Temp\RtmpWme7aH\downloaded_packages

library(‘ggplot2’)

Warning message:
程辑包‘ggplot2’是用R版本3.5.3 来建造的

此时ggplot已成功加载,问题解决!

  • 8
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值