2# lovebluesky
高人,高人,帮帮忙吧~嘿嘿~
B GH 2.5
A ED 1.0
A DR 2.2
C RF 1.5
B DV 2.7
类似上面的文件
R:
data=read.table("**.txt",sep="\t",as.is=TRUE)
compound_list <-c("A","B","C")
fea_list<-c("D","E","F","G","H","R","V")
record <- NULL
for(m in 1:length(compound_list)){
fea <- fea_list[m]
fea_status <- rep(0, dim(GSK)[1])
fea_status[grep(fea, GSK$features)] <- 1
for(d in 1:length(compound_list)){
compound <- compound_list[d]
s_compound<- GSK[,compound]
this_df <- na.omit(cbind(s_compound, fea_status))
}
}
中间部分缺少了部分向量的定义。
比如GSK,features,还有 s_compound<- GSK[,compound]貌似是一个index功能的东西。
dim(GSK)[1]可以计算出总行数
grep(fea, GSK$features)]可以比对GSK$features是不是包含fea代表的特征
本文来自: 人大经济论坛 详细出处参考:
http://www.pinggu.org/bbs/viewthread.php?tid=771901&page=1&from^^uid=1743014