随笔分类 - R语言
摘要:001、正常绘图 plot(1:10, cex = 2, pch = 19) 002、不输出x轴刻度标签 plot(1:10, cex = 2, pch = 19, xaxt = "n") 。 reference 01、https://www.cnblogs.com/shclbear/p/17253
阅读全文
摘要:001、正常绘图 > plot(1:10, cex = 2, pch = 19) 002、只输出绘图内容 > plot(1:10, cex = 2, pch = 19, axes = F) 。 reference 01、https://www.cnblogs.com/shclbear/p/17253
阅读全文
摘要:001、不为整数 > a <- 5.324 > floor(a) == a ## 截断后不相等, 说明带有小数点部分,即不为整数 [1] FALSE 002、是整数 > b <- 324 > floor(b) == b ## 截断小数点后仍然相等,说明是整数 [1] TRUE 。
阅读全文
摘要:001、round,四舍五入 > a <- 5.345 ## 舍去 > round(a) [1] 5 > b <- 5.824 ## 进位 > round(b) [1] 6 002、round,四舍五入指定小数位数 > a <- 8.426532 > round(a, 1) ## 保留一位小数,四舍
阅读全文
摘要:001、测试 a <- c("1.23e-2", "7.56207e-05", "6.86470e-05") as.numeric(a) ## 直接转换为数值类型, 然而并不起作用 02、增加参数(全局使用) options(scipen = 100) ## 小数点后100位不适用科学计数法 b <
阅读全文
摘要:需求: 一张图片,想知道到底是什么颜色, 在R语言中的颜色系统中。 测试图片如下: 001、 install.packages("colorfindr") ## 安装包 library("colorfindr") ## 加载包 get_colors( img = "aa.png", min_shar
阅读全文
摘要:001、 https://palettegenerator.com/ https://www.jianshu.com/p/52f0764179d9
阅读全文
摘要:001、 基础绘图 library(ggplot2) p <- ggplot(faithful, aes(x = eruptions, y = waiting)) + geom_point() p 002、调整标签刻度到绘图区域的间距 p + theme(axis.text.x = element_
阅读全文
摘要:001、 a <- sample(20:80,15) a b <- matrix(a,nrow=3) b par(mfrow = c(2, 1)) barplot(b,width=1,beside=T, space = c(0, 2), main = "xxx") barplot(b,width=1
阅读全文
摘要:软件包安装: 001、系统 [root@localhost test01]# cat /etc/redhat-release ## 系统 CentOS Linux release 8.4.2105 。 002、安装epel软件源 [root@localhost test01]# yum instal
阅读全文
摘要:前者:for (row in 1:nrow(gterms)) { gene_terms <- str_split(gterms[row,"GOs"], ",", simplify = FALSE)[[1]] gene_id <- gterms[row, "query"][[1]] tmp <- da
阅读全文
摘要:R语言中sappy、unlist函数的应用 gene_to_go <- data.frame(gene = rep(gene_ids[eggnog_lines_with_go], times = sapply(eggnog_annoations_go, length)), term = unlist
阅读全文
摘要:001、R 语言中出现如下报错 > a <- 1:5 > b <- letters[1:5] > test <- data.frame(a, b) > library(dplyr) > select(test, a) Error in (function (classes, fdef, mtable
阅读全文
摘要:R 语言中双中括号 [[]]与数据类型列表的关系。 for (row in 1:nrow(gterms)) { gene_terms <- str_split(gterms[row,"GOs"], ",", simplify = FALSE)[[1]] gene_id <- gterms[row,
阅读全文
摘要:R语言中管道符号 %>% 的应用及举例 gterms <- egg %>% dplyr::select(query, GOs) %>% na.omit() gene2go <- data.frame(term = character(), gene = character())
阅读全文
摘要:R语言中na.omit函数的应用 以及 在数据框中的应用 gterms <- egg %>% dplyr::select(query, GOs) %>% na.omit() gene2go <- data.frame(term = character(), gene = character()) 示
阅读全文
摘要:001 96,GO:0051093,GO:0051094,GO:0051171,GO:0051172,GO:0051173,GO:0051239,GO:0051240,GO:0051241,GO:0051246,GO:0051247,GO:0051248,GO:0051252,GO:0051254,
阅读全文
摘要:001、基础绘图 plot(1:10) legend('topleft', ## legend函数默认会带有一个框线 c("Presence", "Absence"), col= "royalblue1", pch = 15, cex = 1, text.font = 2, inset= 0.02)
阅读全文