使用循环从r中的先前列表创建新列表

时间:2014-12-16 13:03:51

标签: r for-loop bipartite

我正在执行一个函数(computeModules {bipartite}),每次运行都会产生不同的结果。我想迭代执行100次。函数的输出包含一个包含多个插槽的列表。我必须从其中一个槽(@modules)中提取一个矩阵,然后对其进行子集以获得我感兴趣的行。我稍后使用这些行来选择向量的位置。最后,我希望获得100个列表,其中包含与每次迭代中子集化的行一样多的子列表。

模拟@modules:

n1 <- structure(c(1, 1, 1, 2, 2, 2, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 2, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 4, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 6, 0, 7, 0, 0, 0, 0, 7, 0, 8, 0, 0, 0, 0, 8, 0, 9, 0, 0, 9, 0, 0, 0, 10, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 11, 0, 12, 0, 0, 12, 0, 0, 0, 0, 13, 0, 0, 0, 0, 13, 14, 0, 0, 14, 0, 0, 0, 0, 15, 0, 0, 0, 0, 15, 16, 0, 0, 16, 0, 0, 0, 17, 0, 0, 17, 0, 0, 0, 0, 18, 0, 0, 0, 0, 18, 0, 19, 0, 0, 0, 0, 19, 20, 0, 0, 20, 0, 0, 0, 0, 21, 0, 0, 21, 0, 0, 0, 22, 0, 0, 22, 0, 0, 0, 23, 0, 0, 0, 23, 0, 0, 24, 0, 0, 24, 0, 0, 0, 25, 0, 0, 25, 0, 0, 0, 26, 0, 0, 0, 26, 0, 0, 27, 0, 0, 27, 0, 0, 0, 28, 0, 0, 0, 28, 0), .Dim = c(7L, 30L))


n2 <- structure(c(1, 1, 2, 2, 2, 2, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 3, 0, 0, 3, 0, 0, 0, 4, 0, 0, 4, 0, 0, 0, 5, 0, 0, 5, 0, 0, 0, 6, 0, 0, 6, 0, 0, 0, 7, 0, 0, 7, 0, 0, 0, 8, 0, 0, 8, 0, 0, 0, 9, 0, 0, 0, 0, 9, 0, 10, 0, 0, 0, 0, 10, 0, 11, 0, 0, 0, 11, 0, 12, 0, 12, 0, 0, 0, 0, 0, 13, 0, 0, 13, 0, 0, 14, 0, 14, 0, 0, 0, 0, 0, 15, 0, 0, 15, 0, 0, 16, 0, 16, 0, 0, 0, 0, 17, 0, 17, 0, 0, 0, 0, 0, 18, 0, 0, 18, 0, 0, 0, 19, 0, 0, 19, 0, 0, 20, 0, 20, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 21, 0, 22, 0, 0, 0, 0, 22, 0, 23, 0, 0, 0, 23, 0, 0, 24, 0, 0, 0, 0, 24, 0, 25, 0, 0, 0, 0, 25, 0, 26, 0, 0, 0, 26, 0, 0, 27, 0, 0, 0, 0, 27, 0, 28, 0, 0, 0, 28, 0), .Dim = c(7L, 30L))

我的代码:

e <- 1:30
nr=2
n=list(n1, n2); comp2=list(); u=list(); m=list()
for(i in 1:nr){
m[[i]] <- n[[i]][,-c(1,2, (ncol(n[[i]])-5):ncol(n[[i]]))] # select columns of interest
comp2[[i]] <- which(n[[i]][,1]==2) # subset by values of column 1 (total 5)
for(j in 1:length(comp2[[i]])){ # here I want to create a 2xlength(comp2[[i]]) list
u[[i]] <- e[unlist(m[[i]][comp2[[i]][j],])] # create list u selecting values of e
}
}

我想获得:

> u
[1]]
> e[unlist(m[[1]][comp2[[1]][1],])]
[1] 12 14 16 17 20
> e[unlist(m[[1]][comp2[[1]][2],])]
[1]  2  9 10 21 22
> e[unlist(m[[1]][comp2[[1]][3],])]
[1] 11
> e[unlist(m[[1]][comp2[[1]][4],])]
[1]  1  3  4  5  6  7  8 13 15 18 19
[[2]]
> e[unlist(m[[2]][comp2[[2]][1],])]
[1] 12 14 16 17 20
> e[unlist(m[[2]][comp2[[2]][2],])]
[1] integer(0)
> e[unlist(m[[2]][comp2[[2]][3],])]
[1]  1  3  4  5  6  7  8 13 15 18 19
> e[unlist(m[[2]][comp2[[2]][4],])]
[1] 11
> e[unlist(m[[2]][comp2[[2]][5],])]
[1]  2  9 10 21 22

但我的代码会覆盖每次迭代的输出,并且只保留每个列表的最后一个:

> u
[[1]]
[1]  1  3  4  5  6  7  8 13 15 18 19
[[2]]
[1]  2  9 10 21 22

如何获得所需的列表列表?

编辑:真实数据示例

data <- structure(list(MC8 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), MC9 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 1L,     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), GC9 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), GC8 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), GC7 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 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 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), P7 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), P8 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), P9 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), P10 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L)), .Names = c("MC8", "MC9", "GC9", "GC8", "GC7", "GC6", "GC5", "GC4", "GC3", "GC2", "GC1", "CC", "CP1", "CP2", "CP3", "CP4", "CP5", "CP6", "CP7", "CP8", "CP9", "S9", "S8", "S7", "S6", "S5", "S4", "S3", "S2", "S1", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10"), class = "data.frame", row.names = c(NA, -40L))

改编代码:

pl <- 40 # number of columns to be deleted in tmp@modules
eox <- unlist(dimnames(data)) # names of rows and columns
L <- vector("list", 2L) # lists
for (i in 1:length(L)) {
tmp <- computeModules(data)
tmp <- tmp@modules
ss1 <- which(tmp[,1]==1) # subsetting module 1
tmp <- tmp[,-c(1,2,(ncol(tmp)-pl+1):ncol(tmp))] # delete columns of no interest
for (j in 1:length(ss1)) {   
L[[i]] <- eox[tmp[ss1[j],]]
# rows of tmp that meet subsetting conditions; use each row to select position in eox. Then, create as many sublists as rows in tmp3 and assign to L[[i]]
}

一切正常但最后一行代码没有产生所需的输出,最后一个循环覆盖了以前的代码。也许可以更直接地获得所需的输出?

2 个答案:

答案 0 :(得分:0)

也许像这样的伪代码?

L <- vector("list", 100L)
for (i in 1:length(L)) {
    tmp <- computeModules(...) # your specific arguments
    tmp <- tmp@modules # just the slot you want
    tmp <- subset(tmp, ...) # your subsetting requirements
    L[[i]] <- tmp # put just the piece/answer you want into the list
}

res <- unlist(L)

或者您可能需要再次循环L并执行不同的操作。或者,如果您这样做:L[[i]] <- computeModules(...)这是您的列表列表。

编辑:包含数据的小版本

library('bipartite')
data(small1976)
L <- vector("list", 1L)
for (i in 1:length(L)) {
    tmp <- computeModules(small1976) # your specific arguments
    tmp <- tmp@modules # just the slot you want
    tmp <- subset(tmp, ...) # your subsetting requirements
    L[[i]] <- tmp # put just the piece/answer you want into the list
}

如果没有子集,tmp是一个数字矩阵。你需要做什么?

编辑2:如果这是正确的,那你就是在思考子集化过程。

library("bipartite")
eox <- unlist(dimnames(data))
pl <- 40
L <- vector("list", 1L)
for (i in 1:length(L)) {
    tmp <- computeModules(data, deep = TRUE)
    tmp <- tmp@modules # just the slot you want
    tmp <- tmp[,-c(1,2,(ncol(tmp)-pl+1):ncol(tmp))] # delete columns of no interest
    ss1 <- which(tmp[,1]==1) # subsetting module 1
    L[[i]] <- eox[ss1] # put just the piece/answer you want into the list
    }

给予L

[[1]]
[1] "1" "2" "4"

但必须有一些随机拟合,我在不同的运行中得到不同的答案。

答案 1 :(得分:0)

我找到了解决输出问题的方法。但是,此输出组合在未分成单独列表的数据框中:

L <- vector("list", 2L)
for (i in 1:length(L)) {
tmp <- computeModules(data, deep = T, deleteOriginalFiles = T, steps = 1000000, tolerance = 1e-10, experimental = F)
tmp <- tmp@modules
s1 <- which(tmp[,1]==1) # subsetting module 1
tmp <- tmp[,-c(1,2,(ncol(tmp)-pl+1):ncol(tmp))] # delete columns of no interest
L[[i]] <- data.frame(tmp[s1,])
}