11.用combn或expand.grid()抽取所有可能样本 combn(4,2) expand.grid(1:4,1:4) 12.ginv函数求矩阵的广义逆 library(MASS) Mat <-
的所有元素 setequal(x,y) #判断x与y是否相等 a %in% y #判断a是否为y中的元素 choose(n, k) #n个里面取k个的组合数 combn (x,n) #x中的元素每次取n个的所有组合 combn(x,n,f) #将这些组合用于指定函数f > x=c(1,4,5) > y=c(2,4,8) > union(x,y)
element_text(size = font_size, family = font_style)) } else { group_pairs = my_combn ggplot2::theme(text = ggplot2::element_text(size = font_size, family = font_style)) }}my_combn <- function(x) { combs <- list() comb_matrix <- combn(x, 2) for (i in 1: ncol(comb_matrix)) {
var_list = combn(names(iris)[1:3], 2, simplify=FALSE) # Make plots.
可以先通过combn函数生成两两之间的list ,然后套用stat_compare_means 函数即可。 #生成两两之间的list group=levels(factor(df$celltype)) comp=combn(group,2) comp # [,1] [,2]
Treatment=factor(data$Treatment, levels=group) #获得Treatment中元素之间的组合,即:设置比较组(将所有实验组分成两两一组进行后续比较) comp=combn
if verb: print('single',p0,p1,p2,p3) # Multiple nodules if len(nd)>1: combN = [] indN = [i for i in range(len(nd))] for i in range(2,len(nd)+1): combN.extend (list(itertools.combinations(indN,i))) combN = [list(c) for c in combN] for cN in combN
序列 dna<-Biostrings::readDNAStringSet("data1_unaln.fasta") 生成序列id的两两组合 gene_pairs<-as.data.frame(t(combn
ggpubr + 箱线图 + 连线差异标注 由于两组之间的连线需要指定两组信息,这里我又想将所有组之间的差异展示出来,所以使用combn函数得到分组信息两两匹配的结果,并使用tapply结合函数将矩阵改变为列表 wtq = levels(data_wt$group) lis = combn(levels(data_wt$group), 2) x <-lis my_comparisons <- tapply(x,
list", length(sets)) # 针对每个重复的集合,创建组合数据框 for (i in 1:length(sets)) { rel[[i]] <- as.data.frame(t(combn
Group","Expression") #设置分组 group=levels(factor(rt$Group)) rt$Group=factor(rt$Group, levels=group) comp=combn Type","Expression") #设置分组 group=levels(factor(rt$Type)) rt$Type=factor(rt$Type, levels=group) comp=combn
2] <- 1 green[, 3] <- 1 # 一张彩图 p_col <- rgbImage(red = red, blue = blue, green = green) # 三个单一图形 p_combn as.Image(red), as.Image(blue), as.Image(green)) display(p_col, method = "raster", all = TRUE) display(p_combn
mp_assign <- readRDS('test.rds')return(unique(mp_assign$spot_type_meta_new))}))))max_win_size <- 15pairs <- combn <- readRDS('test.rds') return(unique(mp_assign$spot_type_meta_new))}))))max_win_size <- 15pairs <- combn function(i){ mp_assign <- readRDS('test.rds') return(unique(mp_assign$spot_type_meta_new))}))))pairs <- combn
is.numeric) %>% names() colors <- c("#788FCE", "#A88AD2", "#E6956F") # 设置颜色 # 获取所有唯一的列对组合 combinations <- combn
eset <- justRMA(phenoData=phenoData, celfile.path=celfiles) ## differential expression combn pData(phenoData)[,1], pData(phenoData)[,2], sep = "_")) design <- model.matrix(~combn
eset <- justRMA(phenoData=phenoData, celfile.path=celfiles) ## differential expression combn pData(phenoData)[,1], pData(phenoData)[,2], sep = "_")) design <- model.matrix(~combn
95 <dbl>, upper_95 <dbl>, p.value <dbl>, #> # global.pval <dbl> Correlation analysis vars_comb = combn
group, color, strokeSize, pointSize, strokeColor, alpha, title ){ pair.pcs <- utils::combn
7 8 for (i in 1:n) { 9 current.comb <- as.vector(combs[i, ][combs[i, ] > 0]) 10 combn
Type","Expression") #设置分组 group=levels(factor(rt$Type)) rt$Type=factor(rt$Type, levels=group) comp=combn