可能重复:
错误:在 R 中找不到函数...
问题:为什么我的 ggplot2 函数不起作用?
背景:Ubuntu 12.04,Gnome 桌面,R 2.15.1,镜像:http ://cran.stat.ucla.edu/
首先,它说下载的源包在“/tmp/Rtmp2GMNV8/downloaded_packages”中。没有'/tmp/Rtmp2GMNV8/downloaded_packages.'
其次,安装了ggplot2。为什么然后“找不到函数“qplot””???
我已经找了几个小时,在网上找不到任何答案。有人知道发生了什么吗?
读数:
emilio@dog:~/R$ sudo R
R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
# I've taken the liberty of omitting a few lines
> install.packages("ggplot2", dependencies=TRUE)
Installing package(s) into ‘/usr/local/lib/R/site-library’
[...]
* DONE (SparseM)
* DONE (sp)
* DONE (mvtnorm)
* DONE (evaluate)
* DONE (Hmisc)
* DONE (maps)
* DONE (hexbin)
* DONE (gpclib)
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (ggplot2)
* DONE (quantreg)
* DONE (mapproj)
* DONE (maptools)
* DONE (multcomp)
* DONE (testthat)
The downloaded source packages are in
‘/tmp/Rtmp2GMNV8/downloaded_packages’
> help(qplot)
No documentation for ‘qplot’ in specified packages and libraries:
you could try ‘??qplot’
> help(ggplot)
No documentation for ‘ggplot’ in specified packages and libraries:
you could try ‘??ggplot’
> data(diamonds, package="ggplot2")
> head(diamonds)
carat cut color clarity depth table price x y z
1 0.23 Ideal E SI2 61.5 55 326 3.95 3.98 2.43
2 0.21 Premium E SI1 59.8 61 326 3.89 3.84 2.31
3 0.23 Good E VS1 56.9 65 327 4.05 4.07 2.31
4 0.29 Premium I VS2 62.4 58 334 4.20 4.23 2.63
5 0.31 Good J SI2 63.3 58 335 4.34 4.35 2.75
6 0.24 Very Good J VVS2 62.8 57 336 3.94 3.96 2.48
> qplot(carat, price, data = diamonds)
Error: could not find function "qplot"
emilio@dog:~$ cd /tmp/Rtmp2GMNV8/downloaded_packages
bash: cd: /tmp/Rtmp2GMNV8/downloaded_packages: No such file or directory