下载、加载R包万能代码
rm(list = ls())
options()BioC_mirror
options(BioC_mirror="http://mirrors.tuna.tsinghua.edu.cn/bioconductor/")
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options()BioC_mirror
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("DESeq2",ask = F,update = F)
dplyr五个基础函数
mutate(data, new = )#新增列
select(test,列名或列的向量)#按照列名列号筛选列
filter(test, 某列名 == ?)#按列的条件筛选行
arrange(test, Sepal.Length)#默认按照Sepal.Length列大小从小到大排
arrange(test, desc(Sepal.Length))#用desc从大到小
summarise(test, mean(Sepal.Length), sd(Sepal.Length))# 计算Sepal.Length的平均值和标准差
使用技能
count统计某列的unique值:
count(test,Species)
管道操作 %>% (cmd/ctr + shift + M):
test %>%
group_by(Species) %>%
summarise(mean(Sepal.Length), sd(Sepal.Length))