[英]What is the difference between ggplot and ggplot2?
everyone!每个人! I am new to r .我是r 的新手。 I have a disease rate data from different counties and I want to visualize them on the map.我有来自不同县的疾病率数据,我想在地图上将它们可视化。
I follow the instructions on this website: https://socviz.co/maps.html我按照本网站上的说明进行操作: https : //socviz.co/maps.html
I wanted to try their example first but R gave me a wrong message:我想先试试他们的例子,但 R 给了我一个错误的信息:
> p <- ggplot(data = county_full,
mapping = aes(x = long, y = lat,
fill = pop_dens,
group = group))
Error in ggplot(data = county_full, mapping = aes(x = long, y = lat, : could not find function "ggplot" ggplot(data = County_full, mapping = aes(x = long, y = lat, : 找不到函数“ggplot”)中的错误
I want to install the ggplot but it said:我想安装 ggplot 但它说:
Warning in install.packages :package 'ggplot' is not available (for R version 3.6.1) install.packages 中的警告:package 'ggplot' 不可用(对于 R 版本 3.6.1)
I don't know how to modify the code so that I can use ggplot2 to try their examples.我不知道如何修改代码,以便我可以使用ggplot2来尝试他们的示例。
Thanks!谢谢!
This rounds up the idea by @dc37: @dc37 总结了这个想法:
library(ggplot2)
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point()
ggplot2
is the package and ggplot()
is the main function. ggplot2
是包, ggplot()
是主要功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.