随笔分类 - R语言
摘要:# 读取txt文件 data <- read.table("your_input_file.txt", header = TRUE, stringsAsFactors = FALSE) # 统计每个节点在V1和V2中的出现次数 V1_counts <- table(data$V1) V2_count
阅读全文
摘要:setwd("C:\\Users\\Administrator\\Desktop") # 读取txt文件 microbial_names <- readLines("your_input_file.txt") # 使用正则表达式提取属水平的名称 genus_names <- sapply(micro
阅读全文
摘要:学习的源头在上图,自己稍微做了点修改 library(reshape2) # 重塑数据框的包,可以实现长数据和宽数据之间的转化 # 加载ggalluvial包(绘图本图所用关键R包),基于ggplot2的ggalluvial包可用来绘制冲击图 library(ggalluvial) library(
阅读全文
摘要:setwd("D:\\Desktop")library(tidyverse)# 数据处理函数data_clean <- function(otu, design, type=c("relative", "absolute"), threshold=0.001, times=100){ # 函数测试数
阅读全文
摘要:setwd("E:\\20220927宏基因组教学\\02后期分析\\05willcox")library(doBy)gene <- read.table('table.l5.relative-SE.txt', sep = '\t', row.names = 1, header = TRUE, st
阅读全文
摘要:library(vegan)library(tidyverse)pairwise.adonis1 <-function(x,factors,p.adjust.m){ x = x %>% as.matrix() co = as.matrix(combn(unique(factors),2)) pair
阅读全文
摘要:setwd("E:\\中国农业科学院\\20220927宏基因组教学\\02后期分析\\01堆叠图")rm(list = ls())library(tidyverse)library(ggplot2)library(ggtree)library(treeio)library(ggsci)librar
阅读全文