学习小组DAY4笔记——小游
2020-12-28 本文已影响0人
you_b615
因为之前就下载好了R和Rstudio所以前面部分就简单浏览了一下(注意:在下载之前记得查看你的用户名(即desktop的上一级)是否是英文的,如果不是记得改成英文的)。
1、认识R和Rstudio
- R是一种编程语言,也是统计计算和绘图的环境,它汇集了许多函数,能够提供强大的功能。R语言软件界面简陋,通常不直接使用。
- Rstudio是免费提供的开源集成开发环境(IDE)。RStudio提供了一个具有很多功能的环境,使R更容易使用,是在终端中使用R的绝佳选择。
2、使用Rstudio做2个简单的图
1. plot(rnorm(50))
rnorm(50)函数生成服从正态分布的50个数,plot函数作图


2.plot(runif(5,10,50))函数生成10-50间的5个随机数,plot函数作图


3. boxplot(iris
Species,col = c("lightblue","lightyellow","lightpink"))
iris$Sepal.length表示iris数据库中Sepal.length这个数据


3、R语言基本操作
1.R-project管理多个R工作目录
详见教程https://mp.weixin.qq.com/s/G-LXN9P2HVLv9v0cvyFJMA
2.dir():显示默认路径

3.+、-、*、/:加减乘除

4.<-:赋值
使用“<-”符号,相当于=

5.rm():删除变量

6.history():列出历史命令 ((相当于直接点击history),再点击下面你所需要的函数就可进入控制台)

7.ctrl+l:清除控制台