Combining Cluster Memberships With Yields
0
0
Entering edit mode
11.1 years ago
robjohn7000 ▴ 110

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 • 1.8k views
ADD COMMENT
0
Entering edit mode

process.yield[hier2 ==i,]

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1788 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6