问题:如果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已成功加载,问题解决!