![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
小白的R语言学习
八千鸟羽
这个作者很懒,什么都没留下…
展开
-
R语言学习(一)
R语言学习1.安装包Installing: install.packages(‘ggplot’)Loading:library(ggplot2)Updating:update.packages() //更新全部的包2.R语言基础创建向量:v=c(1,4,4,3,2,2,3) 或者 w=c(‘’apple",“banana”,“orange”)根据元素位置返回元素:v[c(2,3,4)...原创 2019-08-11 10:55:47 · 1070 阅读 · 0 评论 -
R语言学习(三)3D制图——rayshader包(一)
个人感觉R语言最有趣的就是各种各样的制图包,今天就来学习一个!下面附上原作者Github链接https://github.com/tylermorganwall/rayshader小贴士关于各种包的函数文档可以https://cran.r-project.org/web/packages/available_packages_by_name.html这里找到。管道操作这里先说一些其他的东...原创 2019-08-23 23:51:00 · 4615 阅读 · 1 评论 -
R语言学习(四)ggplot2包(一)
昨天学习的包如果要制作3D图表要和ggplot2包配合使用,所以最近先来学习ggplot2包library(rayshader)dat=diamondsdsmall=diamonds[sample(nrow(diamonds),100),]这里用的是自带的dimonds数据集,从中随机选取100个样本:该数据集将近54,000颗钻石的价格和其他属性的数据集,carat克拉,cut切割...原创 2019-08-24 18:23:06 · 557 阅读 · 0 评论 -
R语言学习(二)
1 柱状图数据准备par(mfrow=c(2,2))barplot(counts,main=“Simple Bar Plot”,xlab=“Improvement”,ylab=“Frequency”)barplot(counts,main=“Horizontal Bar Plot”,xlab=“Frequency”,ylab=“Improvement”,horiz=TRUE)//把上一个...转载 2019-08-12 12:09:32 · 1622 阅读 · 0 评论 -
R语言学习(五)ggplot2包(二)
快开学了,安心在家的日子不多了。。今天也是暑假写笔记的最后一天了,下一次再写估计就是很久以后,,争取九月份入门r语言和bootstrap,毕竟还有好多事啊。。。Layer用法p=ggplot(diamonds,aes(carat,price,colour=cut))p=p+geom_point()+geom_smooth()p钻石数据包。利用Layer可以把绘图设置、数据和出图形式分割...原创 2019-08-27 20:47:59 · 1433 阅读 · 0 评论 -
R语言学习(六)ggplot2包(三)
分组绘制点library(gcookbook)library(ggplot2)hw=heightweighthw$weightGroup=cut(hw$weightLb,breaks=c(-Inf,100,Inf),labels=c("<100",">=100")) ggplot(hw,aes(x=ageYear,y=heightIn,shape=sex,fill=weigh...原创 2019-09-02 16:03:16 · 971 阅读 · 0 评论 -
R语言学习(七)ggplot2包(四)
ggplot2包的学习就要告一段落了~图表字体样式library(ggplot2)library(gcookbook)p=ggplot(heightweight,aes(x=ageYear,y=heightIn))+geom_point()p+ggtitle("Age and Height\n of Schoolchildren")p+theme(axis.title.x=elemen...原创 2019-09-03 19:03:27 · 2063 阅读 · 0 评论 -
R语言学习(八)3D制图——rayshader包(二)
三维密度图library(ggplot2)library(rayshader)ggdiamonds = ggplot(diamonds) + stat_density_2d(aes(x = x, y = depth, fill = stat(nlevel)), geom = "polygon", n = 100, bins = 10, contour...原创 2019-09-02 19:30:38 · 2568 阅读 · 1 评论 -
R语言学习(九)动态制图——gganimater包
gganimater包和之前的3d包一样,是对ggplot2包的扩展,主要是描绘图表的动态变化。GitHub——链接https://github.com/thomasp85/gganimate安装# install.packages('devtools')devtools::install_github('thomasp85/gganimate')示例1——动态箱图library(g...原创 2019-09-02 23:20:58 · 3160 阅读 · 3 评论