小编Sup*_*123的帖子

R对于列表生成因子的所有组合,合并的所有组合以及组合

所以我正在处理癌症阶段数据.假设这种类型的数据集.它是一个数据帧.

   cancertype     stage
TCGA-67-6215-01     1
TCGA-67-6216-01     1
TCGA-67-6217-01     2
TCGA-69-7760-01     2
TCGA-69-7761-01     1
TCGA-69-7763-01     1
TCGA-69-7764-01     1
TCGA-69-7765-01     4
TCGA-69-7980-01     1
TCGA-71-6725-01     1
TCGA-73-4658-01     1
TCGA-73-4659-01     3
TCGA-73-4662-01     1
TCGA-73-4675-01     3
Run Code Online (Sandbox Code Playgroud)

所以我想要的是一个列表,其中每个元素都是一个数据帧.这里有4个可能的癌症阶段.应该有2个级别,3个级别等的每个组合的数据帧,直到数据中的级别数.但也是合并级别的每个组合的数据帧.我的意思是

list(
dataframe of stage1 and 2
dataframe of stage1 and 3
dataframe of stage 1 and 4
dataframe of stage 2 and 3
...etc
dataframe of stage 1,2 and 3
dataframe of stage 2,3 and 4
...
dataframe of stage 1,2 and 3,4
dataframe of stage 1,3 and …
Run Code Online (Sandbox Code Playgroud)

reduce merge combinations split r

5
推荐指数
1
解决办法
498
查看次数

标签 统计

combinations ×1

merge ×1

r ×1

reduce ×1

split ×1