This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Combining Cluster Memberships With Yields

I have a data frame called process.yield:

process    Yield
35        0.38
37        0.29
89        0.75
90        0.82

I also have results of clustering analysis with members in different groups with the following code:

for (i in 1:3){
  clusterNo <- names(which(hier2==i))
  filename=paste(dir, 'cluster',i,'.txt',sep="")
  write(clusterNo, filename) # save cluster member names
}

An example of "clusterNo" members at each iteration:

35
89
90

But I also want to have cluster group outputs conatining group members and their yields (based on the data frame - process.yield) as follows:

process    Yield
35    0.38
89    0.75
90    0.82

I tried with the following code:

for (i in 1:3){
 clusterNo <- names(which(hier2==i))
 members.yield <- names(which(clusterNo %in% process.yield[,1]))
 colnames(members.yield) <- c("process", "Yield")
 filename=paste(dir, 'cluster',i,'.txt',sep="")
 write(members.yield, filename) # save cluster member names
}

This code ouputted "NULL". How can I modify the code t give the expected outputs?

Thanks

r clustering microarray

process.yield[hier2 ==i,]

Replacing this line: members.yield <- names(which(clusterNo %in% process.yield[,1])) with: process.yield[hier2 ==i,] solved the problem. Much appreciated brentp!

0 answers

No answers yet.

Log in to answer this question.