Day4-R语言基础
R安装
(因为已经装过R和Rstudio了,在这里码住一些教程以备以后安装使用)
电脑用户名是中文时的解决办法
R和Rstudio安装
https://cloud.tencent.com/developer/news/290162
https://mp.weixin.qq.com/s?__biz=MzAxMDkxODM1Ng==&mid=2247487157&idx=1&sn=0540a2788eba7b5a96a6d4f907d92718&chksm=9b484e0eac3fc71864f0e1d5959ac5f768bd3289312c2d0776cbe663a888edd056b092175d5c&scene=21#wechat_redirect
R的入门操作
入门作图尝试
plot(rnorm(50))
生成一组符合正态分布的随机数并作图

boxplot(iris$Sepal.Length~iris$Species,col = c("lightblue","lightyellow","lightpink"))
iris是R语言自带的数据框,iris$Sepal.Length表示iris数据框的Sepal.Length这一列数据
注:生信星球的作图教程:
https://mp.weixin.qq.com/s?__biz=MzU4NjU4ODQ2MQ==&mid=2247484642&idx=1&sn=182a3a95a2dca006bdcb977bb8f53763&chksm=fdf84ca0ca8fc5b6a1982341ba0c659554c669146f75438f7a3c39eaac9171679d66059640ab&scene=21#wechat_redirect
修改Rstudio字体大小
(图片引自生信星球教程)

R语言基本操作入门
用Rproject管理工作目录
工作目录:默认的读取和储存位置
一般情况下只有一个工作目录:
setwd()
设置工作目录
getwd()
查看工作目录

如果要使用多个工作目录:
左上角新建project,指定需要的不同工作路径,之后使用时在这个路径下直接双击打开Rproj文件即可
显示文件列表
工作路径下有哪些文件

基本运算
根号:sqrt()
绝对值:abs()
赋值
<-
小于号加上减号,也可以按Alt加上减号

删除变量
rm(变量名)
rm(list = ls())
清空所有变量

列出历史命令
history()

也可以直接点右上角的history标签
清空控制台
按ctrl+l即可
注:拓展资料
生信技能树的R语言视频 https://m.bilibili.com/video/av25643438.html
网友评论