如何将列表中的每个值转换为由函数值组成的列表列表

时间:2019-04-04 09:39:51

标签: r list

我有一个> 1000个值的列表。 dput(head(list)):

@Column
@Convert(converter = AnomalieAckConverter.class)
private AnomalieAck ack;

rWikiPathways包中的函数getXrefList为每个WP值生成一个新的相关基因列表。

输入:(H参数给出外部基因格式的基因)

list("WP100", "WP106", "WP107", "WP111", "WP117", "WP12")

输出:

library(rWikiPathways)
getXrefList(list[[1]], 'H') 

我想将原始列表变成列表列表。 WP值是第i个值,第j个值是getXrefList函数的基因结果列表。


当前进度:

 [1] "ANPEP" "G6PD"  "GCLC"  "GCLM"  "GGT1"  "GGT5"  "GPX1"  "GPX2"  "GPX3"  "GPX4"  "GSR"   "GSS"   "GSTA1"
[14] "GSTA5" "GSTM1" "GSTM2" "GSTT2" "IDH1"  "OPLAH"

输出:

new_list <- lapply(list, function(x){getXrefList(x, 'H')})
new_list[[1]]

理想输出看起来像这样:

 "ANPEP" "G6PD"  "GCLC"  "GCLM"  "GGT1"  "GGT5"  "GPX1"  "GPX2" "GPX3"  "GPX4"  "GSR"   "GSS"   "GSTA1" "GSTA5" "GSTM1" "GSTM2" "GSTT2" "IDH1"  "OPLAH"

以这种方式等等。任何帮助将不胜感激。

已解决。轻松修复。

List
    WP100
          "ANPEP" "G6PD"  "GCLC"  "GCLM"  "GGT1"  "GGT5"  "GPX1"  "GPX2" "GPX3"  "GPX4"  "GSR"   "GSS"   "GSTA1" "GSTA5" "GSTM1" "GSTM2" "GSTT2" "IDH1"  "OPLAH"
    WP106 
          "ABAT" "AGXT" "ASL"  "ASPA" "ASS1" "DARS" "GAD1" "GAD2" "GOT1" "GOT2" "GPT"  "PC"  

0 个答案:

没有答案