原始R版
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
> library(ggplot2)
Error in library.dynam(lib, package, package.lib) :
DLL ‘colorspace’ not found: maybe not installed for this architecture?
In addition: Warning message:
package ‘ggplot2’ was built under R version 3.2.3
Error: package or namespace load failed for ‘ggplot2’
> qplot(weights, prices, color = types)
Error: could not find function "qplot"
....你有一些问题正在运行ggplot2
,我正在尝试通过一个基本的在线教程然后问题,试图在其中一个练习中运行qplot然后我得到错误上面列出的,我已经阅读了以前的帮助查找,经历了以下动议:
install.packages("proto")
install.packages('ggplot2', dep = TRUE)
,@MLavoie,Mike Wise
> install.packages('ggplot2', dependencies = TRUE)
Installing package into ‘C:/Users/Sony/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_2.0.0.zip'
Content type 'application/zip' length 1977368 bytes (1.9 MB)
downloaded 1.9 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Sony\AppData\Local\Temp\RtmpY97TTR\downloaded_packages
> library("ggplot2", lib.loc="~/R/win-library/3.2")
Error in get(Info[i, 1], envir = env) :
cannot open file 'C:/Users/Sony/Documents/R/win-library/3.2/scales/R/scales.rdb': No such file or directory
Error: package or namespace load failed for ‘ggplot2’
会话信息:
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2movies_0.0.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-6 plyr_1.8.3 tools_3.2.3 gtable_0.1.2 Rcpp_0.12.3 grid_3.2.3 munsell_0.4.2
答案 0 :(得分:2)
安装ggplot2后我遇到了同样的错误。解决这个问题的两种方法:
1)你需要在调用qplot()之前加载“library(ggplot2)”
library(ggplot2)
qplot(factor(CLASS), VOLUME, data = abalone, geom = "boxplot")
2)我随机发现在你的代码前添加“ggplot2 ::”也可以使它工作,而无需调用库。
ggplot2::qplot(factor(CLASS), VOLUME, data = abalone, geom = "boxplot")